天天看點

centtos7部署zabbix3.4

https://www.zabbix.com/download      zabbix官網

1、關閉防火牆及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
yum install mariadb-server mariadb -y
mariadb資料庫的相關指令是:
systemctl start mariadb  #啟動MariaDB
systemctl stop mariadb  #停止MariaDB
systemctl restart mariadb  #重新開機MariaDB
systemctl enable mariadb  #設定開機啟動      

3、安裝和配置zabbix 

# rpm -i http://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-2.el7.noarch.rpm

# yum install zabbix-server-mysql zabbix-web-mysql zabbix-agent   (zabbix伺服器、前端、代理)

4、建立初始資料庫

# mysql -uroot -p<password>

# password

mysql> create database zabbix character set utf8 collate utf8_bin;

mysql> grant all privileges on zabbix.* to zabbix@localhost identified by 'password';

mysql> quit;

導入初始模式和資料。系統将提示您輸入新建立的密碼。

# zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -p zabbix

5、為zabbix伺服器配置資料庫

# vi /etc/zabbix/zabbix_server.conf

DBHost=localhost

DBName=zabbix

DBUser=zabbix

DBPassword=password

6、啟動zabbix服務

# systemctl start zabbix-server zabbix-agent httpd

# systemctl enable zabbix-server zabbix-agent httpd

7、為zabbix前端配置php

Zabbix前端的Apache配置檔案位于/etc/httpd/conf.d/zabbix.conf。一些PHP設定已經配置好了。但有必要取消注釋“date.timezone”設定,并為您設定正确的時區。

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 Europe/Riga

php_value date.timezone Asia/Shanghai

8、配置前端

新安裝的Zabbix前端:http://server_ip_or_name/zabbix    登入管理者賬戶:Admin  密碼:zabbix  (大小寫也是需要區分的)

9、安裝配置zabbix-agent端

# rpm -i http://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-2.el7.noarch.rpm

# yum install zabbix-agent

配置zabbxi-agent
grep -n '^'[a-Z] /etc/zabbix/zabbix_agentd.conf 
PidFile=/var/run/zabbix/zabbix_agentd.pid
LogFile=/var/log/zabbix/zabbix_agentd.log
LogFileSize=0
Server=127.0.0.1
ServerActive=127.0.0.1
Hostname=Zabbix server
Include=/etc/zabbix/zabbix_agentd.d/*.conf
其中 Server 和 ServerActive 都指定 zabbixserver 的 IP 位址,不同的是,前者是被動後者是主動。也就是說 S
erver 這個配置是用來允許 127.0.0.1 這個 ip 來我這取資料。而 serverActive 的 127.0.0.1 的意思是,用戶端
主動送出資料給他      
3、啟動zabbxi-agent并設定開機啟動
systemctl enable zabbix-agent.service
systemctl restart zabbix-agent.service      

伺服器配置好後可用性燈若是灰色,有可能是用戶端和伺服器端連接配接的端口沒有開放 

123