zabbix 官网
zabbix4.0 安装
1)安装zabbix yum源
[root@feature1 ~]# rpm -ivh https://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-1.el7.noarch.rpm
2)yum 安装
[root@feature1 ~]# yum install zabbix-agent zabbix-get zabbix-server-mysql zabbix-web zabbix-web-mysql
3)数据库操作
[root@feature1 ~]# mysql -uroot -prootWelcome to the MariaDB monitor. Commands end with ; or \g.Your MariaDB connection id is 9Server version: 10.3.11-MariaDB-log MariaDB ServerCopyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.MariaDB [(none)]> create database zabbix;Query OK, 1 row affected (0.003 sec)MariaDB [(none)]> grant all on zabbix.* to 'zabbix'@'127.0.0.1' identified by 'zabbix-pa';Query OK, 0 rows affected (0.020 sec)
4) 导入数据
/usr/share/doc/zabbix-server-mysql-4.0.5/create.sql.gz gzip -d /usr/share/doc/zabbix-server-mysql-4.0.5/create.sql.gz |mysql -uroot -proot zabbix
5) 编辑zabbix_server.conf
vi /etc/zabbix/zabbix_server.conf # 定义数据库相关的参数DBHost=127.0.0.1 DBPassword=zabbix-pa
systemctl start zabbix-serversystemctl enable zabbix-server
6)zabbix_agent.conf
vi /etc/zabbix/zabbix_agentd.conf #定义Server=127.0.0.1和 ServerActive=127.0.0.1systemctl start zabbix-agentsystemctl enable zabbix-agent
7)httpd
# 如果已经启动了nginx,需要先把nginx关闭,然后启动httpd[root@feature1 ~]# systemctl stop nginx[root@feature1 ~]# systemctl start httpd
8)webui配置
访问,解决php的问题
[root@feature1 ~]# vim /etc/php.inidate.timezone = Asia/Shanghai[root@feature1 ~]# systemctl restart httpd
(date.timezone Asia/Shanghai) /etc/php.ini 默认密码 admin zabbix
Database type mysqlDatabase host 127.0.0.1Database port 0 0 - use default portDatabase name zabbixUser zabbixPassword
问题1
Details Cannot connect to the database. Error connecting to database: Can't connect to MySQL server on '127.0.0.1' (13)
[root@feature1 ~]# setsebool -P httpd_can_connect_zabbix on[root@feature1 ~]# setsebool -P httpd_can_network_connect_db on[root@feature1 ~]# systemctl restart httpd
问题2
Details Cannot connect to the database. The frontend does not match Zabbix database.