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

相關文章
相關標籤/搜索