Search Exchange
Search All Sites
Nagios Live Webinars
Let our experts show you how Nagios can help your organization.Login
Directory Tree
check_http_header
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!
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.
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
-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.
Reviews (0)
Be the first to review this listing!