check_apachestatus_auto.pl v1.2 released
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://blog.spreendigital.de/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
16 Comments to check_apachestatus_auto.pl v1.2 released
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 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
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.
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;
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.
Thanks!!
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.
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:
https://github.com/gebi/nagios_checks/commit/c7519cc7e00ba54a489d043984ef3ae102527287
https://github.com/gebi/nagios_checks/commit/a2fd9f4f05bca68881a8e67ba1c939c025865098
what do you think about them?
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 “http://www.tcomm.es/joomla/index.php/en/downloads-menu/finish/19-unix/11-checkunixmemusage/0.html” 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);
August 3, 2013
November 7, 2013
Hi,
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
February 4, 2016
[…] Those work on top of existing on-premise open source monitoring solutions like Nagios with check_apachestatus_auto.pl (it does support Lighttpd), Cacti (only graphs) with cacti-template-lighttpd, Munin with lighttpd […]
Leave a comment
About Dennis D. Spreen
Search
Recent Posts
- How to compile Lua 5.4.0 for Android as a dynamic library using Android Studio 4
- Please make inline vars usable for production – fix RSP-28892
- How to compile Lua 5.4.0 as a Mac OS X dynamic library
- How to compile Lua 5.4.0 for Linux as a shared library
- How to compile Lua 5.4.0 for Windows
- Daily Wage – a Spigot/Bukkit plugin that pays out a daily wage
- How to compile Lua 5.3.5 for Windows
- Better Collada exporter for Blender with custom properties
- MOS6502-delphi – a MOS 6502 CPU emulator for Delphi
- Pass a multidimensional array as a parameter (with a hidden caveat)
Categories
Tags
Archives
- May 2020
- March 2020
- June 2019
- March 2017
- August 2016
- July 2016
- June 2016
- January 2016
- September 2015
- February 2015
- January 2015
- October 2014
- September 2014
- August 2014
- May 2014
- March 2014
- February 2014
- November 2011
- June 2011
- February 2011
- March 2010
- September 2009
- August 2009
- July 2009
- May 2009
- March 2009
- February 2009
- January 2009
- November 2008
- October 2008
- February 2008
- June 2007
Delphi Feeds
- How To Live Track The ISS International Space Station December 20, 2024
- SmartInspect 4 Beta 1 Released December 20, 2024
- Mastering FastReport in Delphi: Dynamic File Reporting and Visualization December 19, 2024
- This was 2024 overview December 19, 2024
- Mon bilan GitHub pour l'année 2024 December 19, 2024
- Re-Architecting Legacy Applications: Top Software Transformation December 18, 2024
- The Horror of finding the right database! Part 3 December 18, 2024
- Using TeeChart in Vector Magnetics’ RivCross Software for Precise Directional Drilling December 18, 2024
- Upgrading C++Builder 12.2: Tip #7, bcc64x tips! December 17, 2024
- Enhancing Delphi Code Safety: Best practices, tools, and context December 17, 2024
May 14, 2010