This program gathers data from Apache's built-in status page and sends it to Zabbix. The data is sent via the CLI tool zabbix_sender.
*** See http://www.zabbix.com/wiki/templates/apache for a detailed install guide ***
- Paulson McIntyre (GpMidi) [email protected]
- Zach Bailey [email protected]
- Dale Bewley [email protected]
-
Add this to your Apache config file:
<Location /server-status> SetHandler server-status Allow from 127.0.0.1 Order deny,allow Deny from all </Location> ExtendedStatus On # Optional. Must be in global scope and not in a virtual host
-
Restart/reload Apache or use ```kill -USR1 `cat /var/run/httpd.pid ```` for zero downtime
- Import the template file Template_App_Apache_Status.xml into Zabbix
- Link the Template_App_Apache_Status template to the hosts to be monitored
Now continue with either Zabbix Agent Mode mode or Cron mode.
This method relies on your polling interval for an item called apache.status, and will honor any maintenance windows. The check will run on the host being monitored everytime time apache.status is polled. This item is defined as a UserParameter like this:
# returns a single integer, but uses zabbix_sender to populate trapper items
UserParameter=apache.status,/var/lib/zabbix/bin/check_apache --config /etc/zabbix_agentd.conf
Install on apache server to be monitored and connect to status page on localhost. Assumes zabbix-agent is installed.
- Copy bin/check_apache to , such as /var/lib/zabbix/bin/check_apache
- Run chmod +x on the file
- Copy conf/check_apache.conf to your zabbix agent include dir. Probably /etc/zabbix_agentd.conf.d/
- Tip Check to make sure your include directory is enabled.
grep Include /etc/zabbix_agentd.conf
- Tip Make sure you have ServerActive and Hostname filled in your config file.
- Restart zabbix-agent.
This method can run remotely or locally via cron. This method relies on your cron scheduler to set the polling interval, and is unaware of any maintenance windows.
Install on Zabbix server or the host to monitor:
- Copy bin/check_apache to , such as /usr/bin/check_apache
- Run chmod +x on the file
- Add this to crontab to run every minute: * * * * * /usr/bin/check_apache --zabbixsource myhostname -z myzabbixserver &> /dev/null
- Replace "myhostname" with the hostname (or name in the Zabbix GUI) of the host that the values should be stored with. Replace "myzqbbixserver" with the hostname/IP of your Zabbix server.
Repeat above cron lines to monitor multiple hosts. Use the -o option if these URL differs from the hostname.
- Users of cPanel may need to use add the arguments " -l http://localhost/whm-server-status?auto" to prevent a "ValueError: need more than 1 value to unpack".
GPLv2 - See LICENSE file