Webservice check

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
sarpione
Posts: 49
Joined: Fri Oct 14, 2016 10:02 am

Webservice check

Post 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
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Webservice check

Post 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
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
sarpione
Posts: 49
Joined: Fri Oct 14, 2016 10:02 am

Re: Webservice check

Post 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
User avatar
tacolover101
Posts: 432
Joined: Mon Apr 10, 2017 11:55 am

Re: Webservice check

Post 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)
dwhitfield
Former Nagios Staff
Posts: 4583
Joined: Wed Sep 21, 2016 10:29 am
Location: NoLo, Minneapolis, MN
Contact:

Re: Webservice check

Post 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
sarpione
Posts: 49
Joined: Fri Oct 14, 2016 10:02 am

Re: Webservice check

Post 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?
User avatar
cdienger
Support Tech
Posts: 5045
Joined: Tue Feb 07, 2017 11:26 am

Re: Webservice check

Post 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
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Locked