Apache Server – Check if mod_status is Enabled for Server-Status

apache-2.2mod-rewritemuninubuntu-10.04

I've enabled the apache_ plugins on a munin node:
ln -sv /usr/share/munin/plugins/apache_* /etc/munin/plugins/

After restarting the node with service munin-node restart here are the errors I'm getting:

$ munin-node-configure --suggest 2>/dev/null | grep "apache\|Plugin\|------"
Plugin                     | Used | Suggestions                            
------                     | ---- | -----------                            
apache_accesses            | yes  | no [apache server-status not found. check if mod_status is enabled]
apache_processes           | yes  | no [apache server-status not found. check if mod_status is enabled]
apache_volume              | yes  | no [apache server-status not found. check if mod_status is enabled]

However mod_status is already enabled:

$ a2enmod status
Module status already enabled

And restarting apache doesn't make a difference.

If I try to run the plugins manually here is what I get (I read that getting a U is bad news so at least that is consistent).

$ munin-run apache_accesses --debug
# Processing plugin configuration from /etc/munin/plugin-conf.d/munin-node
# Set /rgid/ruid/egid/euid/ to /110/65534/110 110 /65534/
# Setting up environment
# About to run '/etc/munin/plugins/apache_accesses'
accesses80.value U

$ munin-run apache_processes --debug
# Processing plugin configuration from /etc/munin/plugin-conf.d/munin-node
# Set /rgid/ruid/egid/euid/ to /110/65534/110 110 /65534/
# Setting up environment
# About to run '/etc/munin/plugins/apache_processes'
busy80.value U
idle80.value U
free80.value U

$ munin-run apache_volume --debug
# Processing plugin configuration from /etc/munin/plugin-conf.d/munin-node
# Set /rgid/ruid/egid/euid/ to /110/65534/110 110 /65534/
# Setting up environment
# About to run '/etc/munin/plugins/apache_volume'
volume80.value U

Does anybody know why I'm still getting the server-status not found message and how I can get rid of it?

Updated answer 1

Shane's suggestion was correct about setting a request handler using Location and SetHandler in the apache site. For more information on mod_status please refer to this page

I could verify that munin was effectively making the appropriate requests by looking at /var/log/apache2/access.log where I was getting this:

127.0.0.1 - - [10/Nov/2011:07:24:15 +0000] "GET /server-status?auto HTTP/1.1" 404 7774 "-" "libwww-perl/5.834

In my case setting the Location wasn't enough as I am running a Drupal site and the .htaccess combined with mod_rewrite were rewriting the requests. To fix it, I had to add the following line to my .htaccess

  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_URI} !=/favicon.ico
  RewriteCond %{REQUEST_URI} !=/server-status  # <= added this line
  RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]

Please note that this doesn't represent a security problem since access to /server-status is restricted to 127.0.0.1 in the apache site.

Updated answer 2

It appears that adding the Location to the apache site wasn't needed after all since this is already defined in /etc/apache2/mods-enabled/status.conf. Btw, should you want to add the ExtendedStatus On directive, that's in that file that you should do it.

Best Answer

Seems like it's trying to actually make requests to the status module. Do you have a proper config for the status location in your VirtualHost? Something like this:

<Location /server-status>
    SetHandler server-status
    Order deny,allow
    Deny from all
    Allow from 127.0.0.1
</Location>