I use zapache which works just fine for what I want. You can view the page at github, https://github.com/lorf/zapache. Note: there is a document in the download you do called readme.md which describes how to use the module. That is the real documentation, but it is slanted towards centos. The following is "how I do it."
First, it uses Apaches server-status, so you must make sure it is turned on. For Debian, simply turn on the status module with. You will also need to install subversion if you haven't already.
apt-get install subversion
Download and install zapache using svn. I like to keep things all in one spot, so I created a script in /opt/zabbix named updateApacheScripts with the following:
mkdir -p /opt/zabbix/svnexports svn export https://github.com/lorf/zapache /opt/zabbix/svnexports/zapache cp -av /opt/zabbix/svnexports/zapache/trunk/zapache /opt/zabbix chmod 755 /opt/zabbix/zapache chown zabbix:zabbix /opt/zabbix/zapache
I then run this script and have a fresh clean install of zapache
Now, add a file /etc/zabbix/zabbix_agentd.d/zapache with the following contents
Import the two xml files from /opt/zabbix/svnexports/zapache/trunk as templates. Add one of them (bind them) to the server you are monitoring.
How it works
Well, I didn't write this, so I don't have a complete clue. However, apache has the ability to send statistics via the url http://127.0.0.1/server-status, and this script appears to grab that information, parse it, then send it back to the Zabbix Server. BTW, they have some very nice graphs and stuff on this.
This uses the server-status flag to Apache, so here are some basic troubleshooting steps:
- Verify server-status works using a web browser on the client machine (the one zapache is installed on). I use Lynx below, but the URL is going to be the same so you can use wget, or even a GUI web browser if you have a GUI installed
lynx http://localhost/server-status?autoreturns a page of status like Total Accesses, Total kBytes, etc... If you get nothing or an error, it means Apache is not responding to the server-status command, so fix your Apache configuration file
- Once you are sure you can access server-status directly, check the script by executing it with one value to be checked
./zapache TotalAccessesshould return a number, showing total number of accesses.
- If the above works, then verify your permissions as the Zabbix user, which the script is run as.
sudo -u zabbix ./zapache TotalAccessesIf this fails, it means your script is not executable as the Zabbix user.