Search Exchange
Search All Sites
Nagios Live Webinars
Let our experts show you how Nagios can help your organization.Login
Directory Tree
check_http_xpath.pl
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!
The check_http_xpath.pl plugin can be used to check for the presence or absence of specific information in an XML document which is fetched via http.
For example, such an XML document may be an RSS feed or the Tomcat XML status page.
The text to be searched for is specified in the XML XPATH format on the command-line.
Multiple XPATH checks can be done in one operation.
Checks can be any of == != > < <= >= =~ !~
If no operator is specified, the XPATH must simply exist.
Example:
check_http_xpath.pl -H www.us-cert.gov -u /channels/techalerts.rdf -w '/rdf:RDF/item/title!~linux' -s -i
For example, such an XML document may be an RSS feed or the Tomcat XML status page.
The text to be searched for is specified in the XML XPATH format on the command-line.
Multiple XPATH checks can be done in one operation.
Checks can be any of == != > < <= >= =~ !~
If no operator is specified, the XPATH must simply exist.
Example:
check_http_xpath.pl -H www.us-cert.gov -u /channels/techalerts.rdf -w '/rdf:RDF/item/title!~linux' -s -i
Reviews (4)
If the webserver that hosts your XML file supports ETag, then you can speed up things by using that caching mechanism. This is most noticeable with large XML files (such as eduGAIN metadata). I was a fairly trivial patch:
--- check_http_xpath.pl 2018-11-23 16:07:33.521799526 +0100
+++ test.pl 2018-11-24 00:27:34.848817509 +0100
@@ -27,6 +27,7 @@
use Getopt::Std;
use XML::XPath;
use Data::Dumper;
+use HTTP::Cache::Transparent;
my %optarg;
my $getopt_result;
@@ -294,6 +295,10 @@
$lwp_user_agent->default_header('Host' => "$host:$port");
}
+HTTP::Cache::Transparent::init( {
+ BasePath => '/tmp/cache',
+ } );
+
$url = "$http://${host_ip}:${port}$uri";
$http_request = HTTP::Request->new(GET => $url);
--- check_http_xpath.pl 2018-11-23 16:07:33.521799526 +0100
+++ test.pl 2018-11-24 00:27:34.848817509 +0100
@@ -27,6 +27,7 @@
use Getopt::Std;
use XML::XPath;
use Data::Dumper;
+use HTTP::Cache::Transparent;
my %optarg;
my $getopt_result;
@@ -294,6 +295,10 @@
$lwp_user_agent->default_header('Host' => "$host:$port");
}
+HTTP::Cache::Transparent::init( {
+ BasePath => '/tmp/cache',
+ } );
+
$url = "$http://${host_ip}:${port}$uri";
$http_request = HTTP::Request->new(GET => $url);
bysvenw, October 12, 2015
It was trivial to add a couple of lines to be able to POST requests.
bytippy24, April 1, 2014
Thanks, George! We have a number of AcquiSuite DAS units collecting info via internal I/O (discrete inputs) which has proven difficult to get in to nagios to monitor. This plugin has saved our organization from costly Dev projects! If you have an odd-ball device that does crucial monitoring, and server up status metrics via XML, this plugin can save you much heartache!
M. Tipsword, CITES DCG, Univ. of Illinois
M. Tipsword, CITES DCG, Univ. of Illinois