1、系統環境 cat /etc/redhat-release CentOS Linux release 7.3.1611 (Core) 關閉防火牆及selinux systemctl stop firewalld.service systemctl disable firewalld.service sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config grep SELINUX=disabled /etc/selinux/config setenforce 0 2、數據庫安裝及配置 一、MariaDB概述 MariaDB數據庫管理系統是MySQL的一個分支,主要由開源社區在維護,採用GPL受權許可。 開發這個分支的緣由是:甲骨文公司收購了MySQL後,有將MySQL閉源的潛在風險,所以社區採用分支的方式來避開這個風險。 MariaDB的目的是徹底兼容MySQL,包括API和命令行,使之能輕鬆成爲MySQL的代替品。 二、安裝mariadb yum install mariadb-server mariadb -y mariadb數據庫的相關命令是: systemctl start mariadb #啓動MariaDB systemctl stop mariadb #中止MariaDB systemctl restart mariadb #重啓MariaDB systemctl enable mariadb #設置開機啓動 二、Zabbix3.4安裝 rpm -ivh http://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-1.el7.centos.noarch.rpm yum install zabbix-server-mysql zabbix-web-mysql -y 三、建立數據庫 create database zabbix character set utf8 collate utf8_bin; grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix'; 四、導入數據 zcat /usr/share/doc/zabbix-server-mysql-3.4.0/create.sql.gz | mysql -uzabbix -pzabbix zabbix 五、配置數據庫用戶及密碼 grep -n '^'[a-Z] /etc/zabbix/zabbix_server.conf 38:LogFile=/var/log/zabbix/zabbix_server.log 49:LogFileSize=0 72:PidFile=/var/run/zabbix/zabbix_server.pid 99:DBName=zabbix 115:DBUser=zabbix 123:DBPassword=zabbix 314:SNMPTrapperFile=/var/log/snmptrap/snmptrap.log 432:Timeout=4 474:AlertScriptsPath=/usr/lib/zabbix/alertscripts 484:ExternalScripts=/usr/lib/zabbix/externalscripts 520:LogSlowQueries=3000 六、啓動zabbix server並設置開機啓動 systemctl enable zabbix-server systemctl start zabbix-server 七、編輯Zabbix前端PHP配置,更改時區 vim /etc/httpd/conf.d/zabbix.conf php_value date.timezone Asia/Shanghai 八、SELinux配置 setsebool -P httpd_can_connect_zabbix on setsebool -P httpd_can_network_connect_db on 九、啓動httpd並設置開機啓動 systemctl start httpd systemctl enable httpd 5、zabbxi-agent安裝及配置 一、安裝zabbxi-agent yum install zabbix-agent -y 二、配置zabbxi-agent grep -n '^'[a-Z] /etc/zabbix/zabbix_agentd.conf 13:PidFile=/var/run/zabbix/zabbix_agentd.pid 32:LogFile=/var/log/zabbix/zabbix_agentd.log 43:LogFileSize=0 97:Server=172.16.8.254 138:ServerActive=172.16.8.254 149:Hostname=Zabbix server 267:Include=/etc/zabbix/zabbix_agentd.d/*.conf 三、啓動zabbxi-agent並設置開機啓動 systemctl enable zabbix-agent.service systemctl restart zabbix-agent.service