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

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


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.