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

check_http_header

Current Version
0.01
Last Release Date
2010-08-12
Compatible With
  • Nagios 2.x
  • Nagios 3.x
Owner
License
GPL
Hits
104872
Files:
FileDescription
check_http_header.plcheck_http_header.pl
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_http_header is a web content monitor written in perl. Checks http header for text. It`s very rare task... Standart nagios check_http checks only content for regexp existance. So, maybe this plugin will be useful for somebody exept me.

retrieves header of http responce and looks in its output for a given text (regexp). If the text is found returns OK, if not found returns CRITICAL, and UNKNOWN otherwise (connection error,...) plus a brief error description.

It has no other dependencies than PERL itself and some libraries (Getopt::Std and ,WWW::Curl::Easy)
Retrieve an http/s URL and looks in its header (ACHTUNG HTTP header not content!) Output for a given text.
Returns CRITICAL is not found, OK if found, UNKNOWN otherwise.

--help shows this message
--version shows version information

-I IP address or name (use numeric address if possible to bypass DNS lookup).
-u URL to GET
-r regexp to match in the output of http header
-t Timeout in seconds to wait for the URL to load. If the page fails to l
oad,
check_http_header will exit with UNKNOWN state (default 60)
-p Port


Example:
$ curl -I ksimute.trancom.ru
HTTP/1.1 301 Moved Permanently
.....
Vary: Accept-Encoding,Cookie
X-Vary-Options: Accept-Encoding;
.....
......

$ ./check_http_header.pl -I ksimute.trancom.ru -r Vary -p 80 -u / -t 20
OK REGEXP FOUND

$ ./check_http_header.pl -I ksimute.trancom.ru -r Varyddd -p 80 -u / -t 20
REGEXP NOT FOUND


Hint:

If script is not working with embedded perl in nagios typical error (Service check did not exit properly), like many other perl scripts :(, user following line to describe nagios command


define command{
command_name check_header
command_line /usr/bin/perl /usr/lib/nagios/plugins/my/check_http_header.pl -I $HOSTADDRESS$ -p 80 -u '/myurl' -r Regexp -t 20
}

i.e. call external perl for interpretation.