xmlxmlhttprequestnagiosxmlschema

Nagios check_http - from API XMLSchema


I would like to setup the Nagios check "Check_http" to validate the XMLTAG that the value in the XMLTAG is "Licence Valid"

Link to the API is http://IPADDRESS/webapi/webapi.asmx/HealthCheck

<ISAStatus xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://IPADDRESS/WebAPI/">
<DeviceLicence>
<Status>Licence Valid</Status>
</DeviceLicence>
<MultipleARCLicence>
<Status>Missing Licence</Status>
</MultipleARCLicence>
</ISAStatus>

Or is there an easier way with another Nagios Check ?

Thanks


Solution

  • If you're using Nagios XI, rather than check_http you'd get an easier time just using check_xml.php like

    [root@nagiosxi ~]# php /usr/local/nagios/libexec/check_xml.php -u http://127.0.0.1/HealthCheck -k 'DeviceLicence.Status' -s 'Licence Valid'
    OK - Value 'Licence Valid' matched 'Licence Valid'
    

    Now, if you're just using the barebones Nagios Core engine, I'd advise you to get ahold of the aforementioned plugin by downloading the correspondent wizard package — you can find and extract check_xml.php at xml/plugins.