Search Exchange

Search All Sites

Nagios Live Webinars

Let our experts show you how Nagios can help your organization.

Contact Us

Phone: 1-888-NAGIOS-1
Email: sales@nagios.com

Login

Remember Me

Directory Tree

Robert Becht

Current Version
1.0
Last Release Date
2012-02-23
Compatible With
  • Nagios 3.x
Download URL
License
GPL
Hits
102177
Files:
FileDescription
check_apache-auto.plcheck_apache-auto.pl
check_apache-auto.phpcheck_apache-auto.php
1.85_G_check_apache-auto.png1.85_G_check_apache-auto.png
1.85_T_check_apache-auto.png1.85_T_check_apache-auto.png
Nagios CSP

Meet The New Nagios Core Services Platform

Built on over 25 years of monitoring experience, the Nagios Core Services Platform provides insightful monitoring dashboards, time-saving monitoring wizards, and unmatched ease of use. Use it for free indefinitely.

Monitoring Made Magically Better

  • Nagios Core on Overdrive
  • Powerful Monitoring Dashboards
  • Time-Saving Configuration Wizards
  • Open Source Powered Monitoring On Steroids
  • And So Much More!
check_apache-auto.pl
Fetches the 'server-status?auto' page of an apache server, extracts all information and evaluates them.
This script is based on ideas from that offered on "Nagios Exchange" (http://exchange.nagios.org/components/com_mtree/attachment.php?link_id=296&cf_id=24).
check_apache-auto.pl
Fetches the 'server-status?auto' page of an apache server, extracts all information and evaluates them.
This script is based on ideas from that offered on "Nagios Exchange" (http://exchange.nagios.org/components/com_mtree/attachment.php?link_id=296&cf_id=24).
This uses the "server-status? Self" produced by the Apache server (if enabled).
The script contains lines of debugging it is sufficient to enable to fit if necessary.
If authentication for server access is necessary, it may be that the method is not suitable.
In this case just change that part.
Reviews (1)
bylucabert, August 29, 2016
Hi,

Unfortunately your script has problems with Apache 2.4 and, since Apache 2.4.18, can't retrieve the right data.

Here the patch:

--- new/check_apache_auto.pl 2016-08-29 13:33:49.398437552 +0200
+++ orig/check_apache_auto.pl 2016-08-29 13:33:35.070152746 +0200
@@ -5,6 +5,8 @@
use LWP::UserAgent;
use HTTP::Request;

+# WARNING: This version of the script only works with Apache 2.4.13 or higher (changes to mod_status broke the script)
+# See edits on lines 172ff

sub help() {
print timeout(10);
@@ -167,6 +171,18 @@
@recolte = split(/\n/,$htmlbrut);
splice (@recolte, 0, $topnbr);
splice (@recolte, -$endnbr);
+ @recolte = grep /\S/, @recolte;
+
+# Only lines with key: value will be used
+ my $recolte_index = 0;
+ foreach (@recolte) {
+ if (@recolte[$recolte_index] =~ /^.+:.+$/) {
+ $recolte_index++;
+ } else {
+ # remove entry if it doesn't match
+ splice (@recolte, $recolte_index, 1);
+ }
+ }

#Debugging
# print "$req\n";
@@ -252,6 +268,10 @@


%data = apache_status($server);
+if(!exists $data{$mon})
+{
+ $data{$mon} = 0;
+}

#Debugging
#print "uptime=$data{'Uptime'}\n";
@@ -263,10 +283,3 @@
print_result;

exit;

Regards