Zabbix系列之Zabbix安装搭建及汉化

Server端:

1、安装开发软件包

yum  -y groupinstall "Development Tools"

2、安装所需的依赖包

yum -y install httpd mysql mysql-server phpphp-mysql php-common php-mbstring php-gd php-odbc php-pear curl curl-develnet-snmp net-snmp-devel perl-DBI php-xml ntpdate  php-bcmath

3、同步服务端的时间,保持所有服务器时间一致避免出现时间不同导致的不可用的监控数据

ntpdate pool.ntp.rog ---过程略。

4、创建zabbix服务运行所需要的用户和组

groupadd  -g 201  zabbix

useradd  -g zabbix  -u 201 -mzabbix

5centos7 用的是mariadb

安装方法:yum -yinstall mariadb* 

systemctl start mariadb.service 

systemctl enable mariadb.service

6、创建zabbix运行所需要的数据库及用户权限

mysqladmin  -uroot -h127.0.0.1 password "123456"

mysql -uroot -h127.0.0.1 -p

create database zabbix character set utf8;

grant all privileges on zabbix.* tozabbix@'192.168.251.10' identified by 'zabbix';

flush privileges;

7、下载解压zabbix

wgethttp://sourceforge.net/projects/zabbix/files/ZABBIX%20Latest%20Stable/2.2.2/zabbix-2.2.2.tar.gz

cd /usr/src/

tar xf zabbix-2.2.2.tar.gz

cd /usr/src/zabbix-2.2.2

 

8、将zabbix的初始数据导入到数据库中

mysql -uroot -p123456 zabbix <database/mysql/schema.sql

mysql -uroot -p123456 zabbix <database/mysql/images.sql

mysql -uroot -p123456 zabbix < database/mysql/data.sql

 

9、编译安装zabbix

./configure --prefix=/usr/local/zabbix--with-mysql --with-net-snmp --with-libcurl --enable-server --enable-agent--enable-proxy

 

10、添加服务端口:vi /etc/services

zabbix-agent 10050/tcp # Zabbix Agent

zabbix-agent 10050/udp # Zabbix Agent

zabbix-trapper 10051/tcp # Zabbix Trapper

zabbix-trapper 10051/udp # Zabbix Trapper

 

11、添加配置文件

mkdir -p /etc/zabbix

cp -r conf/* /etc/zabbix/

chown -R zabbix:zabbix /etc/zabbix

 

12、修改server配置文件,添加zabbix数据库密码

cp misc/init.d/fedora/core/zabbix_server/etc/init.d/

cpmisc/init.d/fedora/core/zabbix_agentd /etc/init.d/

cp -R frontends/php/var/www/html/zabbix

sed-i 's/^DBUser=.*$/DBUser=zabbix/g' /usr/local/zabbix/etc/zabbix_server.conf

sed-i 's/^.*DBPassword=.*$/DBPassword=zabbix/g' /usr/local/zabbix/etc/zabbix_server.conf

sed-i 's/BASEDIR=\/usr\/local/BASEDIR=\/usr\/local\/zabbix/g' /etc/init.d/zabbix_server

sed-i 's/BASEDIR=\/usr\/local/BASEDIR=\/usr\/local\/zabbix/g' /etc/init.d/zabbix_agentd

 

 

13、改Agentd配置文件,更改HOSTNAME为本机的hostname

vi /etc/zabbix/zabbix_agentd.conf

PidFile=/tmp/zabbix_agentd.pid

EnableRemoteCommands=1

Server=192.168.251.10

Hostname=testserver10

 

 14、启动zabbix server

/etc/init.d/zabbix_server start

/etc/init.d/zabbix_agentd start

echo "/etc/init.d/zabbix_serverstart" >> /etc/rc.local

echo "/etc/init.d/zabbix_agentdstart" >> /etc/rc.local

 

15、修改php.ini

memory_limit = 256M

date.timezone = Asia/Shanghai

post_max_size = 32M

max_execution_time = 600

upload_max_filesize = 16M

max_input_time = 600

 

16、修改apache 的配置文件

<IfModule dir_module>

   DirectoryIndex index.html php

</IfModule>

 

17、图形访问:

web页面配置,配置http访问好了后web登陆:http://ip/zabbix

确认每个Required都是ok的才会显示Next按钮,如果有Fail的需要完善系统要求

202316340.png

202320137.png

202323941.png

202326883.png

这里主要下,出现Fail的原因是zabbix的配置文件没有,需要点击“Download configurationfile”将zabbix.conf.php下载到本地在上传到服务器的zabbix/conf/目录下,然后在web页面Retry即可

 

202329928.png

 

 

202332811.png

到此web页面配置完毕,已经到了登陆界面,zabbix的默认登陆账号是admin,密码是zabbix

202917804.png

 

服务器的zabbix服务必须的重启

 

更换中文字体,登陆后在页面的右上边点击“Prefile”

203239644.png

在Language选项中选择“Chinese(zh_CN)”,然后Save

203241369.png

 

 

 

 

客户端配置:

scp -r zabbix-2.2.2.tar.gz  [email protected]:/usr/src

cd /usr/src

tar xzvf zabbix-2.2.2.tar.gz 

cd zabbix-2.2.2

./configure--prefix=/usr/local/zabbix-2.2.2/ --enable-agent

make && make install 

 

cp misc/init.d/fedora/core/zabbix_agentd/etc/init.d/

/etc/init.d/zabbix_agentd start

echo "/etc/init.d/zabbix_agentdstart" >> /etc/rc.local

 

vi/usr/local/zabbix-2.2.2/etc/zabbix_agent.conf

 

Server=192.168.251.10

UnsafeUserParameters=1

Include=/usr/local/zabbix-2.2.2/etc/zabbix_agent.conf.d/

 

vi  /usr/local/zabbix-2.2.2/etc/zabbix_agentd.conf

Server=192.168.251.10

ServerActive=192.168.251.10

Include=/usr/local/zabbix-2.2.2/etc/zabbix_agentd.conf.d/

UnsafeUserParameters=1

 

 

ln -s /usr/local/zabbix-2.2.2/sbin/*/usr/local/sbin/

ln -s /usr/local/zabbix-2.2.2/bin/*/usr/local/bin/

echo 'zabbix-agent 10050/tcp #Zabbix Agent'>> /etc/services

echo 'zabbix-agent 10050/udp #Zabbix Agent'>> /etc/services

echo 'zabbix-trapper 10051/tcp #Zabbixtrapper' >> /etc/services

echo 'zabbix-trapper 10051/udp #Zabbixtrapper' >> /etc/services

 

systemctl daemon-reload

service zabbix_agentd start

chmod +x /etc/rc.d/init.d/zabbix_agentd

chkconfig zabbix_agentd on

 


你可能感兴趣的:(服务器,zabbix)