I'm sending a request manually over Soap UI currently, the request is as follows.
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"xmlns:sear="http://www.mysite.com/ws/search/searchcustomer">
<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,
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 :)
Thanks again, Ben
It's a bit late to see your question, but hope this helps anyway.
You can do this with the check_http
plugin. The check_http
Nagios plugin is shipped with the Nagios Plugins package (nagios-plugins.org)
With the -P
parameter you can POST
the SOAP request and with the -r
parameter you can (regex) match the response for a specific string.
From the commandline using the check_http
plugin:
(I had to truncate you SOAP request because I coudn't post url's with http headings...)
check_http -H my.webserver.org -p 8080 -u "/testing" -P '<soapenv:Envelope .... </soapenv:Envelope>' -r 'Dublin'
If this works for you, then you need to create a new check command and service check definition in Nagios.
Example check command definition for the webservice command (using also warning and critical repsonse time values)...
define command {
command_name check_webservice
command_line $USER1$/check_http -H $ARG1$ -p $ARG2$ -u $ARG3$ -P $ARG4$ -r $ARG5$ -w $ARG6$ -c $ARG7$
}
...and an example service check definition
define service {
use generic-service
host_name my.webserver.org
service_description check_webservice
check_command check_http_webservice!my.webserver.org!8080!/testing!'<soapenv:Envelope .... </soapenv:Envelope>'!'Dublin'!5!10
}
Please note the quoting: This is essential is these kind of checks!
In the examples above I use single quotes to quote the SOAP POST
request and the response.