1. 程式人生 > >zabbix集群的部署

zabbix集群的部署

zabbix

一 準備系統環境

安裝Centso7 固定ip 關閉firewalld 關閉selinx 修改主機名,做解析/etc/hosts

主機名分別為zbserver zbagent1 zbagent2

二 正式安裝:

 #wget http://repo.zabbix.com/zabbix/3.5/rhel/7/x86_64/zabbix-release-3.5-1.el7.noarch.rpm
 #rpm -ivh http://repo.zabbix.com/zabbix/3.5/rhel/7/x86_64/zabbix-release-3.5-1.el7.noarch.rpm


1 安裝幾個基本的包:

 # yum -y install zabbix-server-mysql zabbix-web-mysql zabbix-get # yum -y install zabbix-agent
 # yum -y install mariadb mariadb-server
 # systemctl enable mariadb
 # systemctl start mariadb

2 登錄mysql,導入數據庫

# mysql

 mysql> create database zabbix character set utf8 collate utf8_bin; 
 mysql> grant all privileges on zabbix.* to zabbix@localhost identified by '123456'; 
 mysql> flush privileges;
 mysql> \q
# cd /usr/share/doc/zabbix-server-mysql-3.0.4/
# zcat create.sql.gz | mysql -uroot zabbix

3 修改配置文件

#/etc/zabbix/zabbix_server.conf

DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix

生效:

# systemctl enable zabbix-server.service 
# systemctl start zabbix-server.service

註意安裝後web界面zabbix服務不能運行查看這個文件:/etc/zabbix/web/zabbix.conf.php

4 修改時區為亞洲上海

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 Asia/Shanghai

三 啟動服務

# systemctl enable zabbix-server.service
# systemctl start zabbix-server.service
# systemctl enable httpd
# systemctl start httpd

web界面訪問:ip:80 httpd是否正常

繼續安裝步驟為:http://ip/zabbix

1 是否全部為OK

2 mysql端口號改為3306 Password:123456

3 name設置為zbserver

4 點擊下一步

5 出現congratulations!

四 正式登錄:

Username :Admin

Password: zabbix

登錄成功!

四 配置agent

1在agent1,agnet2上執行:

 # yum -y install zabbix-agent

vim /etc/zabbix/zabbix_agent.conf

Server= sbserveriP,agent1,ip

ServerActive=sbserverip,agent1,ip

2 服務生效和檢查:

  # systemctl start zabbix-aggent.server
 # systemctl enable zabbix-agent.server
 # ss -anlp |grep :10050

3 記得在web服務端添加被監控的主機










zabbix集群的部署