check_http.pl

This plugin is _no_ replacement of the default nagios check_http plugin.

It provides some functionality which the standard check_http doesn't have.

The standard check_http plugins does not allow to set warning or critical status depending on the page content. check_http can only return OK or Critical if a string (or regular expression) matches.

Using this plugin you can set multiple conditions for warning and/or critical status.

Example:

Combine regex and http codes:

./check_http.pl -H host.domain.com -u /test.html \
    -W '[Ww]arn' -W '[Mm]issing' -C '[Cc]rit' \
    -c 500 -c 404

Capital options (-W and -C) indicate regex patterns which should match the page content. The lowercase options are reserved for the HTTP Codes (regex can be used too).

There still many open tasks like user authentication support, configurable redirect support … Updates will follow.

Usage:

-H
-u (default: /)
-p (default: 80)
-s, --ssl

      connection via ssl (default off)

-w

      state=warning, if the specified http code (404, 303, ...) is returned

-c

      state=critical, if the specified http code (404, 303, ...) is returned

-W

      if regex matches against page content -> state = warning

-C

      if regex matches against page content -> state = critical

-h, --help

      prints this help message

The -w, -c, -W and -C options can be specified multiple times.

If no -w, -c, -W or -C option is specified the following rules apply:

OK:             HTTP Response Code 2xx
WARNING:        HTTP Response Code 3xx
CRITICAL:       HTTP Response Code 4xx or 5xx

But without -w, -c, -W and -C option you better use the standard check_http plugin.

Link to plugin:

check_http

Discussion


Warning: Illegal offset type in isset or empty in /homepages/42/d199844277/htdocs/domains/wiki.wiburg.de/inc/auth/plain.class.php on line 88

Warning: md5() expects parameter 1 to be string, array given in /homepages/42/d199844277/htdocs/domains/wiki.wiburg.de/lib/plugins/avatar/helper.php on line 75

Warning: preg_match() expects parameter 2 to be string, array given in /homepages/42/d199844277/htdocs/domains/wiki.wiburg.de/inc/EmailAddressValidator.php on line 19

Warning: strrpos() expects parameter 1 to be string, array given in /homepages/42/d199844277/htdocs/domains/wiki.wiburg.de/inc/EmailAddressValidator.php on line 24
jpojpo, 2009/07/31 21:21
This script has a bug that prevents it from handling https correctly. The problem resides in the redelaration of the scalar variable protocol in lines 119 and 122. The if statement can be collapsed to 'if ($o_ssl) { $protocol = "https" }'

Warning: Illegal offset type in isset or empty in /homepages/42/d199844277/htdocs/domains/wiki.wiburg.de/inc/auth/plain.class.php on line 88

Warning: md5() expects parameter 1 to be string, array given in /homepages/42/d199844277/htdocs/domains/wiki.wiburg.de/lib/plugins/avatar/helper.php on line 75

Warning: preg_match() expects parameter 2 to be string, array given in /homepages/42/d199844277/htdocs/domains/wiki.wiburg.de/inc/EmailAddressValidator.php on line 19

Warning: strrpos() expects parameter 1 to be string, array given in /homepages/42/d199844277/htdocs/domains/wiki.wiburg.de/inc/EmailAddressValidator.php on line 24
Oliver WittenburgOliver Wittenburg, 2009/08/05 10:15
Thank you jpo. I incorporated your patch in the plugin.
Enter your comment
If you can't read the letters on the image, download this .wav file to get them read to you.
 
nagiosplugins/check_http.txt · Last modified: 2008/08/26 20:48 (external edit)
Recent changes RSS feed Creative Commons License Donate Driven by DokuWiki