centos7 install zabbix-

author :headsen  chen

date :2018-05-07  16:24:34 

安装前准备:
1.1 安装依赖包:
yum -y install wget net-snmp-devel OpenIPMI-devel httpd openssl-devel java lrzsz fping-devel libcurl-devel perl-DBI pcre-devel libxml2 libxml2-devel mysql-devel gcc php php-bcmath php-gd php-xml php-mbstring php-ldap php-mysql.x86_64 php-pear php-xmlrpc net-tools wget vim-enhanced

One, zabbix server3.0 installs
1.1 on centos 7 to build lamp environment

[root@zabbix ~]# yum -y install mariadb mariadb-server php php-mysql httpd

Centos7 installs php5.4, httpd2.4 and maradb5.5 by default

Set up self-start mysql at boot, and start mysql, use the following command:
[root@zabbix ~]# systemctl enable mariadb.service
[root@zabbix ~]# systemctl start mariadb.service

Initialize the mysql database and configure the root user password. Use the following command:
[root@zabbix ~]# mysql_secure_installation
Set the password of mariadb to abc123

To create a zabbix database and its user, use the following command:
[root@zabbix ~]# mysql -uroot -p123456 -e "create database zabbix default character set utf8 collate utf8_bin;"
[root@zabbix ~]# mysql -uroot -p123456 - e "grant all on zabbix.* to 'zabbix'@'%' identified by 'zabbix';"

Now let's test whether the zabbix user just created can connect to the mysql database, as follows:
[root@zabbix ~]# mysql -uzabbix -pzabbix
MariaDB [(none)]> show databases;
MariaDB [(none)]> quit

Start apache and open port 80, as follows:
[root@zabbix ~]# systemctl start httpd.service
[root@zabbix ~]# netstat -ltun

1.2 Install zabbix server3.0

The EPEL source and the yum source of zabbix required to install zabbix3.0 are as follows:
[root@zabbix ~]#rpm -ivh http://repo.zabbix.com/zabbix/3.0/rhel/7/x86_64/zabbix-release- 3.0-1.el7.noarch.rpm
[root@zabbix ~]# yum -y install zabbix-server-mysql zabbix-web-mysql zabbix-get

Perform zabbix related configuration.

Import the zabbix database structure as follows:
[root@zabbix ~]# cd /usr/share/doc/zabbix-server-mysql-3.0.5/
[root@zabbix zabbix-server-mysql-3.0.5]# zcat create. sql.gz | mysql -uroot -pabc123 zabbix

Modify the configuration file of zabbix sever. The four items of DBHost, DBName, DBUser, and DBPassword are modified as follows:
[root@zabbix ~]# vi /etc/zabbix/zabbix_server.conf
LogFile=/var/log/zabbix/zabbix_server.log
LogFileSize= 0
PidFile=/var/run/zabbix/zabbix_server.pid
DBHost=localhost ----------------------------> Modify these four
DBNames =zabbix ------------------------------>
DBUser=zabbix -------------- ----------------->
DBPassword=zabbix ---------------------------->
SNMPTrapperFile=/var/log/snmptrap/snmptrap.log
Timeout=4
AlertScriptsPath=/usr/lib/zabbix/alertscripts
ExternalScripts=/usr/lib/zabbix/externalscripts
LogSlowQueries=3000

In the above configuration file, we only need to pay attention to a few items. These items are the parameters for configuring the zabbix server to connect to the mysql database.
After the above modification is completed, let's modify the zabbix.conf file again. as follows:

vi /etc/httpd/conf.d/zabbix.conf
#php_value date.timezone Asia/Chongqing Define the time zone of php and change it to:
php_value date.timezone Asia/Shanghai

zabbix-server加入开机启动:
[root@zabbix ~]# systemctl start zabbix-server.service
[root@zabbix ~]# systemctl enable zabbix-server.service

Restart apache:
[root@zabbix ~]# systemctl restart httpd.service

3. Configure zabbix through the web page
http://ip/zabbix/

What needs to be filled in the above figure is that the zabbix database we created earlier has a user and password, Next step

The default username is Admin password zabbix then click sign in

Fourth, install zabbix agent
4.1 Install zabbix agent
rpm -ivh http://repo.zabbix.com/zabbix/3.0/rhel/7/x86_64/zabbix-release-3.0-1.el7.noarch.rpm
[root@zabbix ~ ]# yum -y install zabbix zabbix-agent

4.2 Configure zabbix agent
The configuration of zabbix agent is very simple, you only need to modify the three items of Server, ServerActive and Hostname in the zabbix agent configuration file.
Among them, Server and ServerActive are the IP address of the zabbix server, and Hostname is the IP address of the monitored terminal, as follows:
[root@zabbix ~]# vi /etc/zabbix/zabbix_agentd.conf
PidFile=/var/run/zabbix/zabbix_agentd.pid
LogFile=/var/log/zabbix/zabbix_agentd.log
LogFileSize=0
Server=127.0.0.1
ServerActive=127.0.0.1
Hostname=127.0.0.1
Include=/etc/zabbix/zabbix_agentd.d/
After the above configuration is complete, we are in zabbix web When adding the monitoring machine on the client side, you only need to match the honst name with the hostname in the configuration file. as follows:
Server=server ip address
ServerActive=server ip address
Hostname=client ip address
Server passive ServerActive takes the initiative
to this zabbix agent has been installed.
Start the client
[root@zabbix ~]# zabbix_agentd -c /etc/zabbix/zabbix_agentd.conf
[root@zabbix ~]# systemctl start zabbix-agent
[root@zabbix ~]# systemctl restart zabbix-agent
[root@zabbix ~ ]# systemctl enable zabbix-agent

Five, zabbix web Chinese display and optimization
5.1 zabbix web Chinese display
By default, zabbix web displays English, in fact, zabbix supports Chinese, we can open Chinese by modifying the web source file.
Modify the /usr/share/zabbix/include/locales.inc.php file and change the false of the line where zh_CN is located to true, as follows:
[root@zabbix ~]# vim /usr/share/zabbix/include/locales. Inc.php +55
Finally, click on the head avatar in the upper right corner of the zabbix web monitoring page, and select the Chinese language in the pop-up tab. As follows:
5.2 Chinese display optimization
installation Chinese support package
installation method is as follows:
[root@zabbix ~]# wget https://github.com/echohn/zabbix-zh_CN/archive/master.zip
[root@zabbix ~]# unzip master.zip
[root@zabbix ~]# rm /usr/share /zabbix/locale/zh_CN/LC_MESSAGES/frontend.mo
[root@zabbix ~]# cp zabbix-zh_CN-master/frontend.mo /usr/share/zabbix/locale/zh_CN/LC_MESSAGES/frontend.mo
Now restart apache and Two services of zabbix_server are enough, as follows:
[root@zabbix ~]# systemctl restart httpd
[root@zabbix ~]# systemctl restart zabbix-server
[root@zabbix ~]# mv simkai.ttf /usr/share/zabbix/fonts /
[root@zabbix ~]# cd /usr/share/zabbix/fonts/
[root@zabbix fonts]# chmod 777 simkai.ttf
[root@zabbix fonts]# cp graphfont.ttf graphfont.ttf.bak
[root@ zabbix fonts]# mv simkai.ttf graphfont.ttf
mv: Override "graphfont.ttf"? y

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325609764&siteId=291194637