9

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.

Max
  • 3,373
  • 15
  • 51
  • 71

6 Answers6

5

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>
Shane Madden
  • 112,982
  • 12
  • 174
  • 248
  • Valid point indeed although in my case I also had to do some `mod_rewrite` work (see updated question with answer) – Max Nov 10 '11 at 07:43
3

I found out I could run

$ wget http://localhost/server-status?auto

but not

$ wget http://127.0.0.1/server-status?auto

The first one is hitting the default server, the second a virtual server.

So I explicitly added an apache section to /etc/munin/plugin-conf.d/munin-node

[apache_*]
env.url   http://localhost:%d/server-status?auto
env.ports 80

and got my munin apache graphs.

Marji
  • 31
  • 1
2

I found solution from Many Ayromlou on this site:

The problem is that these .htaccess rules in wordpress take over server-info and server-status urls activated in apache’s config and return a page not found error. I came across numerous sites that suggested adding a rule like:

    RewriteCond %{REQUEST_URI} !=/server-status

This didn't work for me. I'm not sure if the multisite version of wordpress (which I'm using) is causing this. The rule that worked beautifully is the following:

    RewriteRule ^(server-info|server-status) - [L]

This rule stops the rewrite engine whenever server-info or server-status is parsed as part of the URL.

janfai
  • 101
  • 1
  • 2
  • The nerdlogger site is no longer available. The `RewriteRule ^(server-info|server-status) - [L]` may not work in every instance, even if placed right before the other RewriteRules. Sometimes creating a separate VirtualHost stanza is easiest as in my answer at: https://serverfault.com/questions/291692/why-do-i-get-a-404-not-found-when-trying-to-get-server-status/648259?noredirect=1#comment1375397_648259 – Cedric Knight Mar 07 '21 at 13:07
1

mod_status built into Apache web server to get server status from a web browser. With this module we can easily find out how well the server is performing. All reports are generated in a html format.

Step1. Check if status module is enabled or not apache2ctl -M or ls /etc/apache2/sites-enabled

Step2. If not enabled, enable it by the command,

sudo a2enmod status

step3. Configure access,

Open /etc/apache2/mods-enabled/status.conf and comment the lines,

        #<Location /server-status>
        #    SetHandler server-status
        #    Require local
        #Require ip 192.0.2.0/24
        #</Location>

And add the following line,

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

We can restrict the access of server status for particular IP’s in this configuration by editing , Allow from our_public_ipaddress instead of Allow from all

Save the status.conf file .

Step4. Restart apache by the command,

/etc/init.d/apache2 restart

Step5. Check the server status page in browser

http://server-ip/server-status

Hope this would be helpful.

Amol
  • 151
  • 5
0

I was having the same problem. Here's some more diagnostic steps. Try doing

munin-run apache_processes autoconf

That's a more direct way to see the same error "no (no apache server-status on ports 80)"

Now try doing

wget http://127.0.0.1/server-status?auto

For me that's giving 403 Forbidden.

I was also seeing 'client denied by server configuration: /var/www/server-status' in my main apache error log

You getting the same?

For me in fact Shane Madden's answer solved it.

Harry Wood
  • 301
  • 3
  • 9
  • Hi Harry, if you're having the same problem then please vote up the question as it increases the probability of getting answers. – Max Nov 10 '11 at 07:16
  • Will do, just as soon as I have enough reputation to vote :-) – Harry Wood Nov 14 '11 at 11:28
0

If /server-status is forbidden only from 127.0.0.1 you can create VirtualHost configuration for 127.0.0.1 with following content:

<VirtualHost *:80>
    ServerAdmin superadmin@somemail.com
    ServerName 127.0.0.1
    DocumentRoot /var/www
    <Directory />
            Options FollowSymLinks
            AllowOverride All
    </Directory>
    <Directory /var/www>
      Options +FollowSymLinks
      AllowOverride None
      order allow,deny
      allow from all
    </Directory>
</VirtualHost>

Here is more detailed explanation

druss
  • 141
  • 2