Zabbix3.0監(jiān)控Apache2.4服務(wù)器狀態(tài)
2017-03-23 00:40:20
17167
Zabbix3.0監(jiān)控Apache2.4服務(wù)器狀態(tài)
我們需要啟動(dòng)mod_status來監(jiān)控apache,執(zhí)行如下命令:
a2enmod status
然后找到status.conf來配置mod_status,如果使用的是Debian發(fā)行版本,status.conf文件應(yīng)該在/etc/apache2/mods-enabled/status.conf,配置如下:
<IfModule mod_status.c>
#
# Allow server status reports generated by mod_status,
# with the URL of http://www.tjdsmy.cn/server-status
# Uncomment and change the ".example.com" to allow
# access from other hosts.
#
ExtendedStatus On
<Location /server-status>
SetHandler server-status
Order deny,allow
Deny from all
Allow from 127.0.0.1
</Location>
Listen 61709
NameVirtualHost 127.0.0.1:61709
<VirtualHost 127.0.0.1:61709>
</VirtualHost>
</IfModule>
然后重啟apache
/etc/init.d/apache2 restart
并添加如下行到zabbix的/etc/zabbix/zabbix_agentd.conf:
# Apache Keys
UserParameter=apache.status[*],wget -q -O /dev/null "http://www.tjdsmy.cn:61709/server-status?auto" && wget -q -O - "http://www.tjdsmy.cn:61709/server-status?auto" | awk '/$1: / {print $NF}'
現(xiàn)在重啟zabbix agent。
/etc/init.d/zabbix-agent restart
之后就可以在zabbix看到apache的監(jiān)控?cái)?shù)據(jù)了。