1. 程式人生 > >zabbix-server新增zabbix-agent

zabbix-server新增zabbix-agent

 

zabbix監控系統搭建好了之後,就需要為各種角色host加入進來,現在新增一臺zabbix-agent:

1.在172.16.23.128上安裝zabbix-agent,zabbix-server:172.16.23.131

# rpm -Uvh http://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-2.el7.noarch.rpm
# cd /etc/yum.repos.d/
# mv epel.repo epel.repo.bak
# yum install zabbix zabbix-agent -y
# mv epel.repo.bak epel.repo

 安裝完成agent端程式之後,現在做一些簡單配置:

# sed -i 's/Server=127.0.0.1/Server=172.16.23.131/g' /etc/zabbix/zabbix_agentd.conf
# sed -i 's/ServerActive=127.0.0.1/ServerActive=172.16.23.131/g' /etc/zabbix/zabbix_agentd.conf
Hostname=172.16.23.128

 然後開啟服務,並檢查日誌是否報錯:

# systemctl start zabbix-agent
# systemctl status zabbix-agent
# tail -f /var/log/zabbix/zabbix_agentd.log
[
[email protected]
zabbix_agentd.d]# tail -f /var/log/zabbix/zabbix_agentd.log 7681:20181209:123239.539 IPv6 support: YES 7681:20181209:123239.539 TLS support: YES 7681:20181209:123239.539 ************************** 7681:20181209:123239.539 using configuration file: /etc/zabbix/zabbix_agentd.conf 7681:20181209:123239.540 agent #0 started [main process] 7682:20181209:123239.540 agent #1 started [collector] 7683:20181209:123239.540 agent #2 started [listener #1] 7684:20181209:123239.541 agent #3 started [listener #2] 7686:20181209:123239.542 agent #5 started [active checks #1] 7685:20181209:123239.543 agent #4 started [listener #3]

 然後配置zabbix的web頁面:

注意:這裡的hostname一定要和zabbix-agent端配置檔案的hostname一致,不然會報錯如下:

[[email protected] zabbix_agentd.d]# tail -f /var/log/zabbix/zabbix_agentd.log 
  7644:20181209:122919.996 TLS support:           YES
  7644:20181209:122919.996 **************************
  7644:20181209:122919.996 using configuration file: /etc/zabbix/zabbix_agentd.conf
  7644:20181209:122919.997 agent #0 started [main process]
  7645:20181209:122919.997 agent #1 started [collector]
  7646:20181209:122919.998 agent #2 started [listener #1]
  7648:20181209:122919.999 agent #4 started [listener #3]
  7647:20181209:122919.999 agent #3 started [listener #2]
  7649:20181209:122920.000 agent #5 started [active checks #1]
  7649:20181209:122920.007 no active checks on server [172.16.23.131:10051]: host [master] not found
  7649:20181209:123120.077 no active checks on server [172.16.23.131:10051]: host [master] not found

 當只添加了host而沒有新增template,那麼日誌並不會報錯,但是web頁面那裡的agent不會變綠:

上面是新增template之後的,所以agent變為了綠色