您的位置:首页 > 运维架构 > Apache

zabbix监控apache

2015-09-07 17:19 513 查看
1、打开apache的Server Status页面,在httpd.conf文件最下边加入代码段。
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
#!/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,添加
UserParameter=apache[*],bash /alidata/zabbix-agentd/scripts/apache_status.sh $1
4、重启zabbix的客户端
本文出自 “运维空间” 博客,请务必保留此出处http://drinkboy.blog.51cto.com/10606290/1692425
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: