check_apachestatus_auto.pl v1.2 released

Tuesday, July 14th, 2009 | 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 check_apachestatus.pl.

Detailed info at http://www.spreendigital.de/blog/nagios/?#check_apachestatus_auto

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

Download
check_apachestatus_auto.tgz
v1.2
check_apachestatus_auto.php.tgz
(PNP template)

Tags: , , , ,

4 Comments to check_apachestatus_auto.pl v1.2 released

magu
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?

Christian
July 27, 2010

Hi There,
I’ve tried to use the check_apachestatus_auto.pl Plugin, but it always fails.
The Check is:
./check_apachestatus_auto.pl –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 # ./check_apachestatus_auto.pl –hostname qsargos01.total.hosting –url http://argos-test.total.hosting/server-status?auto
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

Cjeanneret
August 5, 2010

Hello,

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

*** mine.pl 2010-08-05 15:34:54.374819435 +0200
— check_apachestatus_auto.pl 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);
#my %ERRORS=(‘OK’=>0,’WARNING’=>1,’CRITICAL’=>2,’UNKNOWN’=>3,’DEPENDENT’=>4);

— 30,35 —-

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

Cjeanneret
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 check_apachestatus_auto.pl check_webserver.pl
— check_apachestatus_auto.pl 2009-07-14 13:04:30.000000000 +0200
+++ check_webserver.pl 2010-08-06 08:58:17.000000000 +0200
@@ -190,6 +190,9 @@
my $webcontent = undef;
if ($response->is_success) {
$webcontent=$response->content;
+ 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;

Leave a comment

About

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

QR Code

Search

Categories

Blogroll