十、使用Zabbix Agent监控Windows主机:
node-130节点的操作系统为Windows Server 2012 R2
1、node-130节点下载Windows版本的Zabbix Agent:https://www.zabbix.com/download_agents,zabbix_agents-4.0.14-win-amd64.zip
2、解压至C盘,重命名文件夹:C:\zabbix_agents-4.0.14
3、修改zabbix_agentd.conf配置文件:C:\zabbix_agents-4.0.14\conf\zabbix_agentd.conf
修改前 |
修改后 |
# LogType=file |
LogType=file |
LogFile=c:\zabbix_agentd.log |
LogFile=C:\zabbix_agents-4.0.14\zabbix_agentd.log |
Server=127.0.0.1 |
Server=192.168.0.120 |
# ListenPort=10050 |
ListenPort=10050 |
# ListenIP=0.0.0.0 |
ListenIP=0.0.0.0 |
ServerActive=127.0.0.1 |
ServerActive=192.168.0.120 |
Hostname=Windows host |
Hostname=node-130 |
# HostMetadata= |
HostMetadata=node-130 |
特别说明:
在VMware虚机测试过程中,不要将参数# ListenIP=0.0.0.0的值修改为ListenIP=192.168.0.130,否则重启Windows Server 2012 R2后,zabbix_agentd.log中会提示“listener failed: bind() for [[192.168.0.130]:10050] failed: [0x00002741] 在其上下文中,该请求的地址无效”,导致Zabbix Agent无法开机自启
4、修改node-130节点主机名:
右键“这台电脑”–> 属性 –> 更改设置 –> 更改 –> 输入“计算机名”–> 确定 –> 重启
5、防火墙允许10050端口通信:
控制面板 –> 查看方式(小图标)–> Windows防火墙 –> 高级设置 –> 入站规则 –> 新建规则 –> 端口 –> TCP,特定本地端口(10050)–> 允许连接 –> 勾选“域”、“专用”和“公用”–> 名称“Zabbix Agent”–> 完成
6、将Zabbix Agent注册为系统服务:
Win + R –> cmd
cd \
“C:\zabbix_agents-4.0.14\bin\zabbix_agentd.exe” –config “C:\zabbix_agents-4.0.14\conf\zabbix_agentd.conf” –install
7、node-130节点启动Zabbix Agent:
Win + R –> services.msc
查看10050端口是否被监听:netstat -an | find “10050”
查看日志:C:\zabbix_agents-4.0.14\zabbix_agentd.log
8、Zabbix Web添加node-130节点:
Configuration –> Hosts –> Create host –> Add
9、node-130节点链接Windows监控模板:
勾选所有监控项,点击“Check now”:
10、查看最新监控数据:
11、node-130节点监控Windows Update服务:
说明:
service.info[service,<param>] Information about a service. Returns integer with param as state, startup; string – with param as displayname, path, user; text – with param as description; Specifically for state: 0 – running, 1 – paused, 2 – start pending, 3 – pause pending, 4 – continue pending, 5 – stop pending, 6 – stopped, 7 – unknown, 255 – no such service; Specifically for startup: 0 – automatic, 1 – automatic delayed, 2 – manual, 3 – disabled, 4 – unknown