一、

1、首次为检测apache有没有正常运行写一个脚本

运行中输出1,没有运行输出0:

[root@server etc]# vim /usr/local/zabbix/etc/chk_httpd.sh
#!/bin/bash
netstat -lnpt | grep -q :80
if [ $? -eq 0 ]
then
echo "1"
else
echo "0"
fi

2、给脚本777的权限

[root@server ~]# chmod 777 /usr/local/zabbix/etc/chk_httpd.sh          

3、修改配置文件:

 vim /usr/local/zabbix/etc/zabbix_agentd.conf

添加:UserParameter=httpd.ststus,/usr/local/zabbix/etc/chk_httpd.sh $1

4、杀死进程重新开启:

[root@server ~]# killall -9 zabbix_agentd
[root@server ~]# zabbix_agentd

[root@server ~]# zabbix_get -s 192.168.200.111 -k httpd.status

监控项:

 

触发器:

 

 

图形: