Page 1 of 1

Webservice check

Posted: Mon Aug 14, 2017 2:28 pm
by sarpione
Hello,
I have to make a check a little more complicated.
I have to send a "POST" to a webservice with two parameters and validate the result.
For example I send a string that says "25" and "32" and if answer "2532" is "OK" but if dont answer me or answer me different than 2532 say "CRITICAL".
Any idea?
thx

Re: Webservice check

Posted: Mon Aug 14, 2017 2:51 pm
by scottwilkerson
check_http is the plugin you want.
http://nagios-plugins.org/doc/man/check_http.html

the -P option is what you are looking for

here's an example of what it would look like from the command line:

Code: Select all

/usr/local/nagios/libexec/check_http -H your-site.org -u /path/to/page -P='arg1=25&arg1=32' -r 2532

Re: Webservice check

Posted: Mon Aug 14, 2017 3:42 pm
by sarpione
Thx for the quick answer.
Can u explain me more detailed? maybe step by step how i can do that? until know im only use the wizards in the NAGIOS XI.
thx

Re: Webservice check

Posted: Mon Aug 14, 2017 3:49 pm
by tacolover101
this document should help explain the process - https://assets.nagios.com/downloads/nag ... gement.pdf

TL;DR - core config manager -> create a host -> create a service, assign the service to the host you just created, assign check_http to the service, line up your $ARG#$ variables with what @scottwilkerson mentioned, then apply the remainder of your parameters for the service, and lastly an apply configuration to push it into effect. (this may not make sense, and in that case you'll probably want to look at the document above)

Re: Webservice check

Posted: Mon Aug 14, 2017 4:42 pm
by dwhitfield
thanks @tacolover101!

In this case there's check_http, but if you run into a similar situation in the future and the doc tl101 provided seems to be missing some pieces, many of those pieces are likely available at https://assets.nagios.com/downloads/nag ... ios-XI.pdf

Re: Webservice check

Posted: Tue Aug 15, 2017 2:58 pm
by sarpione
I explain better:

The wsdl of this service layer is: http: // "ip" /WSIntranet2016.svc?wsdl
 
The method is called statusGlobal.
 
A POST is made of the following:
<Envelope xmlns = "http://schemas.xmlsoap.org/soap/envelope/">
     <Body>
         <StatusGlobal xmlns = "http://tempuri.org/" />
     </ Body>
</ Envelope>
 
SOAPAction: http://tempuri.org/IWSIntranet2016/statusGlobal
 
The return should contain the line:
<STATUS> DBOracleOK </ STATUS>

i try this /usr/local/nagios/libexec/check_http -H "IP" -u /path/to/page -P='arg1=<Envelope xmlns = "http://schemas.xmlsoap.org/soap/envelope/">
     <Body>
         <StatusGlobal xmlns = "http://tempuri.org/" />
     </ Body>
</ Envelope>' -r DBOracleOK

Of course dosent work... pls help?

Re: Webservice check

Posted: Tue Aug 15, 2017 3:57 pm
by cdienger
Try the following:

Code: Select all

/usr/local/nagios/libexec/check_http -H IP -u /path/to/page -P '<Envelope xmlns = "http://schemas.xmlsoap.org/soap/envelope/">
     <Body>
         <StatusGlobal xmlns = "http://tempuri.org/" />
     </ Body>
</ Envelope>' -r DBOracleOK