时间:2021-05-09 07:44:46 | 栏目: | 点击:次
Zabbix自动发现规则监控Linux系统的service units
1、 在scripts目录编写脚本,脚本内容如下:

2、 在/etc/zabbix_agentd.conf.d目录编写配置文件,内容如下:
vim service_status.conf
UserParameter=service.status,/usr/local/zabbix/scripts/service_status.sh
3、 重启zabbix_agentd:
systemctl restart zabbix_agentd
4、 在zabbix的web界面制作模板,模板的监控项通过自动发现规则来做,自动发现规则内容如下:

监控项原型的key值的定义:
system.run[cat /tmp/service_status.txt | grep -w '{#SN}' | awk '{print $1" "$2" "$3" "$4}' | awk '{print $NF}',]
5、 在最新数据查看结果:

总结