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
原文地址:http://drinkboy.blog.51cto.com/10606290/1692425