一、zabbix-agent端配置
#zabbix-server服務器地址 Server=192.168.30.155 #zabbix-server服務器地址 ServerActive=192.168.30.155 #注釋掉這行,不需要配置 # Hostname= #配置自動注冊,system.uname獲取系統名稱 HostMetadataItem=system.uname
#重啟zabbix-agent服務
[root@comput2 tools]# systemctl restart zabbix-agent #查看狀態 [root@comput2 tools]# systemctl status zabbix-agent ● zabbix-agent.service - Zabbix Agent Loaded: loaded (/usr/lib/systemd/system/zabbix-agent.service; disabled; vendor preset: disabled) Active: active (running) since Thu 2017-07-06 00:55:39 CST; 18s ago Process: 4912 ExecStart=/usr/sbin/zabbix_agentd -c $CONFFILE (code=exited, status=0/SUCCESS) Main PID: 4914 (zabbix_agentd) Tasks: 6 (limit: 4915) CGroup: /system.slice/zabbix-agent.service ├─4914 /usr/sbin/zabbix_agentd -c /etc/zabbix/zabbix_agentd.conf ├─4915 /usr/sbin/zabbix_agentd: collector [idle 1 sec] ├─4916 /usr/sbin/zabbix_agentd: listener #1 [waiting for connection] ├─4917 /usr/sbin/zabbix_agentd: listener #2 [waiting for connection] ├─4918 /usr/sbin/zabbix_agentd: listener #3 [waiting for connection] └─4919 /usr/sbin/zabbix_agentd: active checks #1 [idle 1 sec] Jul 06 00:55:39 comput2 systemd[1]: Starting Zabbix Agent... Jul 06 00:55:39 comput2 systemd[1]: zabbix-agent.service: PID file /run/zabbix/zabbix_agentd.pid not readable (yet?) after start: No such file or directory Jul 06 00:55:39 comput2 systemd[1]: zabbix-agent.service: Supervising process 4914 which is not our child. We'll most likely not notice when it exits. Jul 06 00:55:39 comput2 systemd[1]: Started Zabbix Agent.
#設置為開機自啟動
[root@comput2 tools]# systemctl enable zabbix-agent
Created symlink /etc/systemd/system/multi-user.target.wants/zabbix-agent.service → /usr/lib/systemd/system/zabbix-agent.service.
二、查看系統名稱
[root@comput2 tools]# hostname comput2
三、配置自動注冊
主機名稱似(客戶端名稱)
添加主機
添加到主機群組
添加:與模板關聯
四、查看效果
在zabbix-server服務端查看日志
[root@zabbix-server ~]# tail -f /var/log/zabbix/zabbix_server.log 23761:20170705:115704.235 item "comput1:net.if.out[virbr0-nic]" became not supported: Cannot find information for this network interface in /proc/net/dev. 23749:20170705:123545.715 executing housekeeper 23749:20170705:123545.833 housekeeper [deleted 5653 hist/trends, 0 items, 0 events, 4 problems, 0 sessions, 0 alarms, 0 audit items in 0.117358 sec, idle for 1 hour(s)] 23740:20170705:130511.927 enabling Zabbix agent checks on host "comput2": host became available 23764:20170705:130512.161 item "comput2:net.if.in[virbr0-nic]" became not supported: Cannot find information for this network interface in /proc/net/dev. 23764:20170705:130512.161 item "comput2:net.if.in[virbr0]" became not supported: Cannot find information for this network interface in /proc/net/dev. 23764:20170705:130512.161 item "comput2:net.if.out[virbr0-nic]" became not supported: Cannot find information for this network interface in /proc/net/dev. 23764:20170705:130512.161 item "comput2:net.if.out[virbr0]" became not supported: Cannot find information for this network interface in /proc/net/dev. 23749:20170705:133546.293 executing housekeeper 23749:20170705:133546.410 housekeeper [deleted 6482 hist/trends, 0 items, 0 events, 2 problems, 0 sessions, 0 alarms, 0 audit items in 0.115685 sec, idle for 1 hour(s)]