Zabbix for Apache

I use zapache which works just fine for what I want. You can view the page at github, Note: there is a document in the download you do called 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."


On Client

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.

a2enmod status
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:

#! /bin/bash

mkdir -p /opt/zabbix/svnexports svn export /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

UserParameter=zapache[*],/opt/zabbix/zapache $1


On Server

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, 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:

  1. 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?auto
    returns 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
  2. Once you are sure you can access server-status directly, check the script by executing it with one value to be checked
    ./zapache TotalAccesses
    should return a number, showing total number of accesses.
  3. If the above works, then verify your permissions as the Zabbix user, which the script is run as.
    sudo -u zabbix ./zapache TotalAccesses
    If this fails, it means your script is not executable as the Zabbix user.
Last update:
2016-09-19 23:16
Average rating:0 (0 Votes)

You can comment this FAQ

Chuck Norris has counted to infinity. Twice.

Comment of l3br4:
I have tried your directions but I always get ZBX_NOTSUPPORTED when running the zapache script. Do ... show moreyou by chance have an idea why?
Added at: 2016-09-19 20:35

Comment of Rod:
I modified the article to show some basic troubleshooting steps.
Added at: 2016-09-19 23:17

Comment of l3br4:
Rod, Your troubleshooting steps were on point. My issue was that I could not access my ... show moreserver-status page. After correcting my status.conf settings I was successfully able to pull the data with zapache. Thank you!
Added at: 2016-09-20 17:36