Zabbix3.0监控Apache2.4服务器状态

我们需要启动mod_status来监控apache,执行如下命令:

a2enmod status

然后找到status.conf来配置mod_status,如果使用的是Debian发行版本,status.conf文件应该在/etc/apache2/mods-enabled/status.conf,配置如下:

<IfModule mod_status.c>
#
# Allow server status reports generated by mod_status,
# with the URL of http://servername/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://localhost:61709/server-status?auto" && wget -q -O - "http://localhost:61709/server-status?auto" | awk '/$1: / {print $NF}'

现在重启zabbix agent。

/etc/init.d/zabbix-agent restart

之后就可以在zabbix看到apache的监控数据了。

标签:监控ZabbixApache 发布于:2019-11-18 19:40:06