Build precise queries to find exactly what you need
Press ESC to close
Your review has been submitted and is pending approval.
Check an XML web page for specific content using the XML XPATH syntax.
Current Version
1.1
Last Release Date
2011-04-19
Owner
George Hansper
License
GPL
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
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);
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
Absoluting amazing! You just need to understand XPath syntax. Thanks
You must be logged in to submit a review.
To:
From: