[Nagiosplug-devel] check_http enhancement

Earl Dukerschein eadukers at facstaff.wisc.edu
Tue May 31 21:17:58 CEST 2011


I work for the University of Wisconsin at Madison, Division of 
Information Technology.  We have about 600 staff and a platform
of 500 servers.  I  work mostly with OpenView.  A coworker and I are 
using Nagios plugins to do simple probes and avoid SiteScope licenses fees.

A group of System Administrators is starting to use the Nagios package 
for probes they care about.

We seem to have budget cuts every year, so increased opensource use is 

I have run into the situation where the http page I am checking is a 
service aggregate health-check page
that will contain "health:true" or "health:false" and a field for errors.

So I check for "health:true".   But, if that is not found, after the 
warning message, I would like a print out of
the content, to be able to pass the text to another program to parse out 
the error fields.

This seems to me like a useful and easy change.   Below is my not very 
informed attempt at making the change (v1.4.15),
which seems to work.  I arbitrarily chose the "-x" switch for this 

[ead at cordelia plugins]$ diff check_http.c check_http.c.orig
< * EAD 5/23/2011 Added switch -x, to print content of a web page when the
< *               expected text (-r "text to find") has not been found.
< int switch_x = 0;
<     {"text", no_argument, 0, 'x'},
<     c = getopt_long (argc, argv, 
"Vvh46t:c:w:A:k:H:P:j:T:I:a:b:e:p:s:R:r:u:f:C:xnlLSm:M:N", longopts, 
 >     c = getopt_long (argc, argv, 
"Vvh46t:c:w:A:k:H:P:j:T:I:a:b:e:p:s:R:r:u:f:C:nlLSm:M:N", longopts, 
<     case 'x': /* print what was found when pattern is not found */
<       switch_x = 1;
<       break;
<       if (invert_regex == 0) {
<         if(switch_x == 0)
<              asprintf (&msg, _("%spattern not found, "), msg);
<       else
<              asprintf (&msg, _("%spattern not found, %s, "), msg, page);
<       }
 >       if (invert_regex == 0)
 >         asprintf (&msg, _("%spattern not found, "), msg);
<   printf ("       [-j method] [-x]\n");
 >   printf ("       [-j method]\n");
[ead at cordelia plugins]$


More information about the Devel mailing list