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_xpath.pl

Rating
6 votes
Favoured:
2
Current Version
1.1
Last Release Date
2011-04-19
Owner
License
GPL
Hits
100708
Files:
FileDescription
check_http_xpath.plcheck_http_xpath.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 an XML web page for specific content using the XML XPATH syntax.
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
Reviews (4)
bydnmvisser, November 23, 2018
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);
bysvenw, October 12, 2015
It was trivial to add a couple of lines to be able to POST requests.
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
byachoo, October 24, 2013
Absoluting amazing! You just need to understand XPath syntax.

Thanks