Page 1 of 1

Monitoring web service

Posted: Tue Mar 05, 2013 7:05 am
by eddie
Hi there,
I am new to Nagios so I am probably asking basic questions. I have web service which returns XML that I want to monitor. The XML returns if the services I am monitoring are available or not so I basically need Nagios to fetch the XML from web service and read through it and fin if any monitoring tags are set to FALSE which means the service is down.

This is an example of the XML tag I would like to interpret, the status would change from TRUE or FALSE if the service is unavailable.
<check name="Service1" status="TRUE" description="Test if Service 1 is available" priority="1">

Anybody done anything like this or know of documentation on how to implement in Nagios XI

Thank's
eddie

Re: Monitoring web service

Posted: Tue Mar 05, 2013 1:09 pm
by sreinhardt
Probably the easiest way to do this would be the Website URL wizard. This way, you can either create one check to search for False in general, then be notified to look at the page, or create individual checks looking for <check name="Service1" status="TRUE" description="Test if Service 1 is available" priority="1"> as a whole, and if not found alert. If you choose to look for false in general, you will want to complete the wizard then modify the check within CCM to invert the regex, so that when false is found, it alerts instead of normally the check works that if the string is not found it alerts.

Re: Monitoring web service

Posted: Tue Mar 05, 2013 1:14 pm
by abrist
You could use the website url monitoring wizard and search for a "FALSE" string. I assume you have a url that returns the XML?
If you need more control over the check, you could create a custom service check with the check_http plugin (the same one the wizard uses).
http://nagiosplugins.org/man/check_http

Otherwise you could write a custom script to wget the xml, parse it for certain strings and then return the proper exit code.
http://nagiosplug.sourceforge.net/devel ... lines.html