1. 程式人生 > >基於CentOS 7.x上部署Zabbix 3.4

基於CentOS 7.x上部署Zabbix 3.4

zabbix 3.4 監控 linux 服務器

1、安裝zabbix最新版epel源:

rpm -ivh http://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-1.el7.centos.noarch.rpm

2、安裝zabbix服務端軟件包:

yum install zabbix-server-mysql zabbix-web-mysql -y

CentOS 7.x上MySQL數據庫叫mariadb,需要安裝以下包,請大家自行yum安裝:
[[email protected] conf.d]# rpm -qa | grep maria
mariadb-5.5.52-1.el7.x86_64
mariadb-libs-5.5.52-1.el7.x86_64
mariadb-server-5.5.52-1.el7.x86_64
mariadb-test-5.5.52-1.el7.x86_64
mariadb-devel-5.5.52-1.el7.x86_64
[[email protected] conf.d]# mysql_secure_installation    #數據庫初始化命令

3、安裝並配置MySQL數據庫:

MariaDB [(none)]> create user zabbix identified by ‘123456‘;
MariaDB [(none)]> create database zabbix;
MariaDB [(none)]> grant all on zabbix.* to ‘zabbix‘@‘%‘ identified by ‘123456‘;
MariaDB [(none)]> flush privileges;

4、導入zabbix服務器數據庫文件:

[[email protected] ~]# zcat /usr/share/doc/zabbix-server-mysql-3.4.0/create.sql.gz | mysql -u zabbix -p123456 -D zabbix

5、修改zabbix配置文件:

[[email protected] conf.d]# more /etc/zabbix/zabbix_server.conf | grep -v "#" | grep -v "^$"
LogFile=/var/log/zabbix/zabbix_server.log
LogFileSize=0
PidFile=/var/run/zabbix/zabbix_server.pid
DBName=zabbix
DBUser=zabbix
DBPassword=123456       #只需要設備MySQL數據庫zabbix用戶對應密碼
SNMPTrapperFile=/var/log/snmptrap/snmptrap.log
Timeout=4
AlertScriptsPath=/usr/lib/zabbix/alertscripts
ExternalScripts=/usr/lib/zabbix/externalscripts
LogSlowQueries=3000

6、修改Apache服務器下,php相關的配置文件:

[[email protected] conf.d]# vi /etc/httpd/conf.d/zabbix.conf
php_value max_execution_time 300
php_value memory_limit 128M
php_value post_max_size 16M
php_value upload_max_filesize 2M
php_value max_input_time 300
php_value always_populate_raw_post_data -1
php_value date.timezone Asia/Shanghai    #該項取消註釋,並設置對應的時區

7、配置完成,啟動zabbix管理界面完成最後的安裝配置,設置zabbix-server與mariadb啟動與開機啟動:

[[email protected]]# systemctl start zabbix-server
[[email protected]]# systemctl enable zabbix-server
[[email protected]]# systemctl start mariadb
[[email protected]]# systemctl enable mariadb
[[email protected]]# systemctl start httpd
[[email protected]]# systemctl enable httpd

8、Web登錄:http://服務器IP/zabbix,Ok搞定了!


9、Zabbix界面顯示亂碼問題解決:

字體存放的目錄:/usr/share/zabbix/fonts/

[[email protected] zabbix]# ll /usr/share/zabbix/include/defines.inc.php

[[email protected] zabbix]# sed -i ‘s/graphfont/DejaVuSans/g‘ ./include/defines.inc.php

[[email protected] zabbix]# ll fonts/

總用量 17960

-rwxrwxrwx. 1 root root 18387092 8月 24 15:48 DejaVuSans.ttf

lrwxrwxrwx. 1 root root 33 8月 24 13:55 graphfont.ttf -> /etc/alternatives/zabbix-web-font


參考文章:

  1. https://www.zabbix.com/documentation/3.4/manual/installation/install_from_packages/rhel_centos

  2. https://www.zabbix.com/documentation/3.4/manual/installation/install#installing_frontend

本文出自 “MessageTech” 博客,請務必保留此出處http://msgll.blog.51cto.com/6990666/1959016

基於CentOS 7.x上部署Zabbix 3.4