zabbix安装

zabbix 官网 https://www.zabbix.com/php

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 -proot
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 9
Server version: 10.3.11-MariaDB-log MariaDB Server

Copyright (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-server
systemctl enable zabbix-server

6)zabbix_agent.conf

vi /etc/zabbix/zabbix_agentd.conf #定义Server=127.0.0.1和 ServerActive=127.0.0.1
systemctl start zabbix-agent
systemctl enable zabbix-agent

7)httpd

# 若是已经启动了nginx,须要先把nginx关闭,而后启动httpd

[root@feature1 ~]# systemctl stop nginx
[root@feature1 ~]# systemctl start httpd

8)webui配置

http://ip/zabbix 访问,解决php的问题mysql

[root@feature1 ~]# vim /etc/php.ini

date.timezone = Asia/Shanghai
[root@feature1 ~]# systemctl restart httpd

(date.timezone Asia/Shanghai) /etc/php.ini 默认密码 admin zabbixnginx

Database type  mysql
Database host 127.0.0.1
Database port 0 0 - use default port
Database name zabbix
User zabbix
Password

问题1

Details Cannot connect to the database. Error connecting to database: Can't connect to MySQL server on '127.0.0.1' (13)web

[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.sql

相关文章
相关标签/搜索