v1.2 released

Tuesday, July 14th, 2009 | Dennis D. Spreen | Nagios

A Nagios plugin that parses the status page of an apache or lighttpd server, the plugin returns the response time, the amount of idle, busy, open (apache only) and total slots. The perfdata returns the status of all slots including Requests/sec, Bytes/Request and Bytes/sec. Optionally you can specify how much slots should be available. Use http(s) and basic user authentication with non standard server-status urls. This is an enhanced version of an enhanced version of Lieven De Bodt’s

Detailed info at

Whats new
v1.1 Works with lighttpd server-status as well, added accesses perfdata (Lighttpd v1.4.19 tested)
v1.2 Updated perf data to be PNP compliant, added proxy option

Tags: , , , ,

16 Comments to v1.2 released

May 14, 2010

Hi there, I’ve been trying to set this up to monitor Lighttpd but I’ve been experiencing this weird issue where if I run the command locally as one user, I get the correct output. Any subsequent runs by other users get no output. What’s worse, trying to get the results through NRPE yields a “NRPE: Unable to read output” from check_nrpe.

Do you run this check locally or remotely?

July 27, 2010

Hi There,
I’ve tried to use the Plugin, but it always fails.
The Check is:
./ –hostname “hostname” –url http://“hostname”/server-status?auto
If I tried it with user root and user nagios out of the bash, all works fine.

If i tried to check it via nrpe or online via nagios, I always becomes a failure:

(Service check did not exit properly)

My output in the bash is:
qsargos01:/opt/nagios/libexec # ./ –hostname –url
APACHE OK – 0.028 sec. response time, Busy/Idle 1/74, open 949/1024, ReqPerSec 0.1, BytesPerReq 1289, BytesPerSec 111|Idle=74 Busy=1 OpenSlots=949 Slots=1024 Starting=0 Reading=0 Sending=1 Keepalive=0 DNS=0 Closing=0 Logging=0 Finishing=0 ReqPerSec=0.086761 BytesPerReq=1289 BytesPerSec=111.918873 Accesses=154qsargos01:/opt/nagios/libexec #

It looks like there is a Problem with the output data. Why there is always this line “qsargos01:/opt/nagios/libexec #” directly behind the output?

Thanks in advance

August 5, 2010


Thank you for this update. May I suggest a new change ?

*** 2010-08-05 15:34:54.374819435 +0200
— 2009-07-14 13:04:30.000000000 +0200
*************** use Digest::MD5 qw(md5 md5_hex);
*** 30,36 ****
# Nagios specific

use lib “/usr/local/nagios/libexec”;
– use lib “/usr/lib/nagios/plugins”;
use utils qw(%ERRORS $TIMEOUT);

— 30,35 —-

This patch allow your script to work on a debian installation, using debian packages.

August 6, 2010

Hello again,

For the lib, it’s not a problem – perl -I is a good friend.

But I checked how you get Server type… and, well, I think it can be done in a smarter way:

diff -u
— 2009-07-14 13:04:30.000000000 +0200
+++ 2010-08-06 08:58:17.000000000 +0200
@@ -190,6 +190,9 @@
my $webcontent = undef;
if ($response->is_success) {
+ my @t = split(‘/’, $response->header(‘server’)) ;
+ $httpserver = $t[0];

my $Uptime = 0;
if($webcontent =~ m/Uptime: (.*?)\n/) {
@@ -212,11 +215,8 @@

my $BusyWorkers= 0;
– if($webcontent =~ m/(BusyWorkers|BusyServers): (.*?)\n/) {
– $BusyWorkers = $2;
– if ($1 eq ‘BusyServers’) {
– $httpserver = ‘LIGHTTPD’;
– }
+ if($webcontent =~ m/(:?BusyWorkers|BusyServers): (.*?)\n/) {
+ $BusyWorkers = $1;

my $IdleWorkers=0;

October 5, 2010

I’m curious if you have any interest in expanding the functionalities of this plugin. We’re looking to monitor the activity of threads on a more detailed level. We have some situations where after an incident we’re stuck with tons of threads in the ‘Sending Reply’ or ‘Graceful Finishing’ state. I’m curious if you would consider adding in functionality to watch thread types and allow for warning and critical thresholds to be applied to them.


October 21, 2010

sorry, overlooked your comment – those thread infos are hard to retrieve (you need to write an extra apache module).. I am not aware of any existing modules to use – do you know any?

December 4, 2010

I am getting a error with the PNP file.

templates/check_apachestatus.php [30]:

Undefined index: Slots

And I really have no clue how to fix this.

December 4, 2010

never mind — helps if I name the file right.

December 7, 2010

You’re welcome.

Eric Schoeller
April 29, 2011

Sorry just saw that you replied. There are no extras needed to provide the thread scoreboard. It’s part of server status. All this plugin would need to do is parse the scoreboard and generate notifications based on the number of threads in a certain state.

December 14, 2011

Thx for your really helpfull apache check.

we have added 2 additional features:
– once added the path to make your check work on debian
– changed the warn/critical from absolut values to percent (as many apache are configured in a way to have a different slot count after the first apache master process generation)

Both formatted as nice and seperated patches:

what do you think about them?

Charles Tassell
April 14, 2012

A note to people who get the “NRPE: Unable to read output” error. The script leaves a tempfile in /tmp that is owned by the user who runs it. So if you run it as a user other than that which runs your NRPE it will die because it can’t create a new dropfile.

To fix this, delete the file (it’s called /tmp/_check_apachestatus_auto. and then add the line “unlink($TempFile); to line 289 of the script, right before the “” line.

September 6, 2012

Thx Charles, fixed my problem.
Propesed change to the script

# my $TempFile = $TempPath.$o_host.’_check_apachestatus_auto’.md5_hex($url);
#The $ is the effective user id.
my $name=getpwuid($<);
my $TempFile = $TempPath.$o_host.'_check_apachestatus_auto'.'_'.$name.'_'.md5_hex($url);

Christian S
November 7, 2013

When im trying to do a combined graph i get a error from your template that something is wrong.
This is the output.

Undefined variable: DS

file [line]:

templates.special/check_apachestatus_auto.php [21]:

im trying to do it in op5 that uses pnp4nagios

[…] Those work on top of existing on-premise open source monitoring solutions like Nagios with (it does support Lighttpd), Cacti (only graphs) with cacti-template-lighttpd, Munin with lighttpd […]

Leave a comment

About Dennis D. Spreen

I'm an avid programmer working on a variety of platforms in a variety of languages with a wide technical interest.


QR Code