Use nagios to send xml request to web service, and retrieve

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
gsd_pe
Posts: 7
Joined: Tue Mar 25, 2014 2:18 am

Use nagios to send xml request to web service, and retrieve

Post by gsd_pe »

I'm sending a request manually over Soap UI currently, the request is as follows.

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelop ... chcustomer">
<soapenv:Header/>
<soapenv:Body>
<sear:searchCustomerRequest>
<sear:sustomerID>0000245</sear:sustomerID>
<sear:registrationStatus>R</sear:registrationStatus>
<sear:versionNumber>1.0</sear:versionNumber>
</sear:searchCustomerRequest>
</soapenv:Body>
</soapenv:Envelope>

Now, I was hoping it would be possible to sent this using the check_http class/function in Nagios XI, Do you know if this is possible?
I would hope it would give me the following:

<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
<env:Header/>
<env:Body>
<ns2:searchGprnResponse xmlns:ns2="http://www.mysite.com/ws/gasmapservice/searchcustomer">
<ns2:areaName>Blackrock, County Dublin</ns2:areaName>
<ns2:townName>Dublin City</ns2:townName>
<ns2:countyName>Dublin</ns2:countyName>
</ns2:searchcustomer>
</env:Body>
</env:Envelope>

I would then like to grep for, lets say "Dublin", and if the count is > 0 then it would give an OK, if it doesn't return this, then it would give a failure.
I'm new to nagios, and am finding it a bit complicated to get this working,
Any Ideas would be greatly appreciated, I was thinking CURL might work, not sure though :)
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Use nagios to send xml request to web service, and retri

Post by abrist »

You can submit post data with check_http:

Code: Select all

./plugins/check_http --help | grep -4 post
 -s, --string=STRING
    String to expect in the content
 -u, --url=PATH
    URL to GET or POST (default: /)
 -P, --post=STRING
    URL encoded http POST data
 -j, --method=STRING  (for example: HEAD, OPTIONS, TRACE, PUT, DELETE)
    Set HTTP method.
 -N, --no-body
So your check may look something like:

Code: Select all

check_http -H <host>  -P "Post data here" -r "Dublin"
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
Locked