wiuyiyi 发表于 2015-9-8 08:35:23

zabbix监控apache

1、打开apache的Server Status页面,在httpd.conf文件最下边加入代码段。
1
2
3
4
5
6
7
ExtendedStatus On
<location /server-status>
SetHandler server-status
Order Deny,Allow
Deny from all
Allow from 127.0.0.1
</location>




2、通过脚本获取zabbix需要的item的值,在/alidata/zabbix-agentd/scripts/目录下写个脚本apache_status.sh

1
2
3
4
5
6
#!/bin/bash
if [[ "$1" = "Workers" ]]; then
wget --quiet -O - http://127.0.0.1/server-status?auto | grep Score | grep -o "\." | wc -l
else
wget --quiet -O - http://127.0.0.1/server-status?auto | head -n 9 | grep $1 | awk -F ":" '{print $2}'
fi





3、修改zabbix的配置文件/usr/local/zabbix-agentd/etc/zabbix_agentd.conf,添加

1
UserParameter=apache[*],bash /alidata/zabbix-agentd/scripts/apache_status.sh $1




4、重启zabbix的客户端

页: [1]
查看完整版本: zabbix监控apache