[Nagiosplug-devel] check_http enhancement
Earl Dukerschein
eadukers at facstaff.wisc.edu
Tue May 31 21:17:58 CEST 2011
Hello,
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
inevitable.
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
functionality:
[ead at cordelia plugins]$ diff check_http.c check_http.c.orig
31,32d30
< * 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.
125d122
< int switch_x = 0;
196d192
< {"text", no_argument, 0, 'x'},
242c238
< 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,
&option);
---
> 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,
&option);
264,266d259
< case 'x': /* print what was found when pattern is not found */
< switch_x = 1;
< break;
1064,1069c1057,1058
< 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);
1456c1445
< printf (" [-j method] [-x]\n");
---
> printf (" [-j method]\n");
[ead at cordelia plugins]$
Earl
More information about the Devel
mailing list