在被监控的主机, 需要有一个zabbix的agent来负责将监控数据发送给proxy或直接发送给server.
同时agentd也支持监听, proxy和server可以主动要求agent调用监控命令. 但是在安全性要求较高的环境, 一般不开启agent的被动模式, 只使用主动模式, 即agent主动往外发监控数据, 但是不接受任何远程调用.
In a passive check the agent responds to a data request. Zabbix server (or proxy) asks for data, for example, CPU load, and Zabbix agent sends back the result.
Active checks require more complex processing. The agent must first retrieve a list of items from Zabbix server for independent processing. Then it will periodically send new values to the server.
配置agentd.conf如下, 连接到proxy.
# vi /opt/zabbix/etc/zabbix_agentd.confPidFile=/tmp/zabbix_agentd.pidLogFile=/tmp/zabbix_agentd.logLogFileSize=10EnableRemoteCommands=0StartAgents=0ServerActive=172.16.3.150:10052Hostname=agent150RefreshActiveChecks=120
启动agentd # useradd zabbix_agent[root@150 etc]# su - zabbix_agent -c "zabbix_agentd -c /opt/zabbix/etc/zabbix_agentd.conf"
在zabbix WEB 添加主机, 注意主机名和agentd.conf Hostname配置一致.
重启proxy, 因为proxy是从server获取配置的, 所以必须重启获取刚才添加的主机. 否则agent会报找不到主机的错误.
33315:20140901:155115.763 no active checks on server [172.16.3.150:10052]: host [agent221] not found
33315:20140901:155315.787 no active checks on server [172.16.3.150:10052]: host [agent221] not found
需开启监听, 允许远程调用, Server配置一个列表, 表示允许被哪些远程的服务端IP连接本agent.
PidFile=/tmp/zabbix_agentd.pidLogFile=/tmp/zabbix_agentd.logLogFileSize=10EnableRemoteCommands=1LogRemoteCommands=1Server=172.16.3.150ListenPort=10050ListenIP=0.0.0.0StartAgents=8ServerActive=172.16.3.150:10052Hostname=agent150RefreshActiveChecks=120
[参考]