Page 1 of 2

Monitor Web Service

Posted: Wed Jan 13, 2016 3:51 pm
by jkinning
I have been tasked to see if Nagios can monitor a Web Service which I said it could, Nagios can do anything you want is my actual words. :D

So, I found this thread https://support.nagios.com/forum/viewto ... =6&t=34367 but honestly I am not sure what all this means. I looked up the switches:

Code: Select all

check_http -S -k 'SOAPAction: ping' -r 'Current Status.*OK' -T text/xml -P '<s:envelope s="http://schemas.xmlsoap.org/soap/envelope/"><s:header/><s:body><ping/><s:Body><s:Envelope>' -t 10 -m 512 -p 8083 -H 192.168.1.254 -u /Services/Search/search.svc

-S = Connect via SSL. Port defaults to 443. VERSION is optional, and prevents auto-negotiation (1 = TLSv1, 2 = SSLv2, 3 = SSLv3).
-k = Any other tags to be sent in http header. Use multiple times for additional headers
-r = Search page for regex STRING
-T = specify Content-Type header media type when POSTing
-P = URL encoded HTTP POST data
-t = Seconds before connection times out (default: 10)
-m = Minimum page size required (bytes) : Maximum page size required (bytes)
-p = port
-H = host
-u = URL to GET or POST (default: /)

Here is the information I was provided to have Nagios monitor:

Code: Select all

Policy Services Ping:
Test Link: http://eisiibl1t:7080/wsfg/EntService/Policy/PolicyServicesPing?wsdl

Soap Response: 

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
   <soapenv:Body>
      <NS1:PolicyServicesPingDataResponse xmlns:NS1="http://www.site.com/PolicyServicesPing/">
         <NS1:policyServicesPingDataResponse>INL11D-EIS_IS-PolicyServices-UP1234</NS1:policyServicesPingDataResponse>
      </NS1:PolicyServicesPingDataResponse>
   </soapenv:Body>
</soapenv:Envelope>
Here is what I have:

Code: Select all

check_http -H eisiibl1d -p 7080 -k 'SOAPAction: ping' -r 'INL11D-EIS_IS-PolicyServices-UP1234' -T text/xml -t 10 -m 512 -u /wsfg/EntService/Policy/PolicyServicesPing?wsdl
HTTP CRITICAL: HTTP/1.1 200 OK - pattern not found - 3032 bytes in 0.035 second response time |time=0.035006s;;;0.000000 size=3032B;512;0;0

Re: Monitor Web Service

Posted: Thu Jan 14, 2016 11:15 am
by tgriep
In the URL path, there is a ? in it so that could be causing the problem. Try adding single quotes around it like below and see if that resolves the issue.

Code: Select all

check_http -H eisiibl1d -p 7080 -k 'SOAPAction: ping' -r 'INL11D-EIS_IS-PolicyServices-UP1234' -T text/xml -t 10 -m 512 -u '/wsfg/EntService/Policy/PolicyServicesPing?wsdl'
If it still fails, add a -v "Verbose Output" to the command and post it here.

Lastly, in your post, there are 2 different hosts. Are they both setup the same?

Re: Monitor Web Service

Posted: Thu Jan 14, 2016 12:24 pm
by jkinning
Sorry for the confusion. Test (t) and Development (d) are currently the same.

Code: Select all

check_http -H eisiibl1d -p 7080 -k 'SOAPAction: ping' -r 'INL11D-EIS_IS-PolicyServices-UP1234' -T text/xml -t 10 -m 512 -u '/wsfg/EntService/Policy/PolicyServicesPing?wsdl' -v
GET /wsfg/EntService/Policy/PolicyServicesPing?wsdl HTTP/1.1
User-Agent: check_http/v1.5 (nagios-plugins 1.5)
Connection: close
Host: eisiibl1d:7080
SOAPAction: ping


http://eisiibl1d:7080/wsfg/EntService/Policy/PolicyServicesPing?wsdl is 3032 characters
STATUS: HTTP/1.1 200 OK
**** HEADER ****
Server: Apache-Coyote/1.1
Content-Type: text/xml;charset=utf-8
Content-Length: 2870
Date: Thu, 14 Jan 2016 17:14:39 GMT
Connection: close
**** CONTENT ****
<?xml version="1.0" encoding="UTF-8"?><!--File PolicyServicesPing.wsdl, shared library PolicyServices_lib--><wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" name="PolicyServicesPing" targetNamespace="http://www.site.com/PolicyServicesPing/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://www.site.com/PolicyServicesPing/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <wsdl:documentation>
    <wsdl:appinfo source="WMQI_APPINFO">
      <MRWSDLAppInfo imported="true">
        <binding hasEncoding="false" imported="true" name="PolicyServicesPingSOAP" originalBindingStyle="document"/>
      </MRWSDLAppInfo>
    </wsdl:appinfo>
  </wsdl:documentation>

        <wsdl:types>
                <xsd:schema elementFormDefault="qualified" targetNamespace="http://www.site.com/PolicyServicesPing/" xmlns:ibmSchExtn="http://www.ibm.com/schema/extensions">
<xsd:include schemaLocation="http://eisiibl1d:7080/wsfg/EntService/Policy/PolicyServicesPing?xsd=xsd0"/>
    </xsd:schema>
        </wsdl:types>
        <wsdl:message name="PolicyServicesPingDataRequest">
                <wsdl:part element="tns:PolicyServicesPingData" name="parameters"/>
        </wsdl:message>
        <wsdl:message name="PolicyServicesPingDataResponse">
                <wsdl:part element="tns:PolicyServicesPingDataResponse" name="parameters"/>
        </wsdl:message>
        <wsdl:message name="PolicyServicesPingDataFault">
                <wsdl:part element="tns:PolicyServicesPingDataFault" name="parameters"/>
        </wsdl:message>
        <wsdl:portType name="PolicyServicesPing">
                <wsdl:operation name="PolicyServicesPingData">
                        <wsdl:input message="tns:PolicyServicesPingDataRequest" name="PolicyServicesPingDataRequest"/>
                        <wsdl:output message="tns:PolicyServicesPingDataResponse" name="PolicyServicesPingDataResponse"/>
                        <wsdl:fault message="tns:PolicyServicesPingDataFault" name="PolicyServicesPingDataFault"/>
                </wsdl:operation>
        </wsdl:portType>
        <wsdl:binding name="PolicyServicesPingSOAP" type="tns:PolicyServicesPing">
                <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
                <wsdl:operation name="PolicyServicesPingData">
                        <soap:operation soapAction="http://www.site.com/PolicyServicesPing/PolicyServicesPingData"/>
                        <wsdl:input name="PolicyServicesPingDataRequest">
                                <soap:body use="literal"/>
                        </wsdl:input>
                        <wsdl:output name="PolicyServicesPingDataResponse">
                                <soap:body use="literal"/>
                        </wsdl:output>
                        <wsdl:fault name="PolicyServicesPingDataFault">
                                <soap:fault name="PolicyServicesPingDataFault" use="literal"/>
                        </wsdl:fault>
                </wsdl:operation>
        </wsdl:binding>
        <wsdl:service name="PolicyServicesPing">
                <wsdl:port binding="tns:PolicyServicesPingSOAP" name="PolicyServicesPingSOAP">
                        <soap:address location="http://eisiibl1d:7080/wsfg/EntService/Policy/PolicyServicesPing"/>
                </wsdl:port>
        </wsdl:service>
</wsdl:definitions>
HTTP CRITICAL: HTTP/1.1 200 OK - pattern not found - 3032 bytes in 0.009 second response time |time=0.009005s;;;0.000000 size=3032B;512;0;0
According to the Developer I should see this response

Code: Select all

Policy Services Ping:
Test Link: http://eisiibl1d:7080/wsfg/EntService/Policy/PolicyServicesPing?wsdl

Soap Response: 

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
   <soapenv:Body>
      <NS1:PolicyServicesPingDataResponse xmlns:NS1="http://www.site.com/PolicyServicesPing/">
         <NS1:policyServicesPingDataResponse>INL11D-EIS_IS-PolicyServices-UP1234</NS1:policyServicesPingDataResponse>
      </NS1:PolicyServicesPingDataResponse>
   </soapenv:Body>
</soapenv:Envelope>
Then search for INL11D-EIS_IS-PolicyServices-UP1234 as the up or down indicator.

Re: Monitor Web Service

Posted: Thu Jan 14, 2016 4:39 pm
by rkennedy
I'm failing to see the response that the developer mentioned, can you wget http://eisiibl1d:7080/wsfg/EntService/P ... sPing?wsdl and attach it here?

This should help in the matching since we don't have the page available here.

Re: Monitor Web Service

Posted: Fri Jan 15, 2016 4:00 pm
by jkinning
Attached.

Re: Monitor Web Service

Posted: Mon Jan 18, 2016 11:32 am
by rkennedy
Ah, I missed the -k parameter in your check. I think the header request isn't being sent properly. Try this -

Code: Select all

check_http -H eisiibl1d -p 7080 -k "Content-Type: text/xml;charset=UTF-8" -k 'SOAPAction:ping' -r 'INL11D-EIS_IS-PolicyServices-UP1234' -T text/xml -t 10 -m 512 -u '/wsfg/EntService/Policy/PolicyServicesPing?wsdl' -v
Let us know the result.

Re: Monitor Web Service

Posted: Tue Jan 19, 2016 4:00 pm
by jkinning

Code: Select all

 ./check_http -H eisiibl1d -p 7080 -k "Content-Type: text/xml;charset=UTF-8" -k 'SOAPAction:ping' -r 'INL11D-EIS_IS-PolicyServices-UP1234' -T text/xml -t 10 -m 512 -u '/wsfg/EntService/Policy/PolicyServicesPing?wsdl' -v
GET /wsfg/EntService/Policy/PolicyServicesPing?wsdl HTTP/1.1
User-Agent: check_http/v1.5 (nagios-plugins 1.5)
Connection: close
Host: eisiibl1d:7080
Content-Type: text/xml;charset=UTF-8
SOAPAction:ping


http://eisiibl1d:7080/wsfg/EntService/Policy/PolicyServicesPing?wsdl is 3032 characters
STATUS: HTTP/1.1 200 OK
**** HEADER ****
Server: Apache-Coyote/1.1
Content-Type: text/xml;charset=utf-8
Content-Length: 2870
Date: Tue, 19 Jan 2016 20:59:41 GMT
Connection: close
**** CONTENT ****
<?xml version="1.0" encoding="UTF-8"?><!--File PolicyServicesPing.wsdl, shared library PolicyServices_lib--><wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" name="PolicyServicesPing" targetNamespace="http://www.westernsouthernlife.com/PolicyServicesPing/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://www.westernsouthernlife.com/PolicyServicesPing/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <wsdl:documentation>
    <wsdl:appinfo source="WMQI_APPINFO">
      <MRWSDLAppInfo imported="true">
        <binding hasEncoding="false" imported="true" name="PolicyServicesPingSOAP" originalBindingStyle="document"/>
      </MRWSDLAppInfo>
    </wsdl:appinfo>
  </wsdl:documentation>

        <wsdl:types>
                <xsd:schema elementFormDefault="qualified" targetNamespace="http://www.westernsouthernlife.com/PolicyServicesPing/" xmlns:ibmSchExtn="http://www.ibm.com/schema/extensions">
<xsd:include schemaLocation="http://eisiibl1d:7080/wsfg/EntService/Policy/PolicyServicesPing?xsd=xsd0"/>
    </xsd:schema>
        </wsdl:types>
        <wsdl:message name="PolicyServicesPingDataRequest">
                <wsdl:part element="tns:PolicyServicesPingData" name="parameters"/>
        </wsdl:message>
        <wsdl:message name="PolicyServicesPingDataResponse">
                <wsdl:part element="tns:PolicyServicesPingDataResponse" name="parameters"/>
        </wsdl:message>
        <wsdl:message name="PolicyServicesPingDataFault">
                <wsdl:part element="tns:PolicyServicesPingDataFault" name="parameters"/>
        </wsdl:message>
        <wsdl:portType name="PolicyServicesPing">
                <wsdl:operation name="PolicyServicesPingData">
                        <wsdl:input message="tns:PolicyServicesPingDataRequest" name="PolicyServicesPingDataRequest"/>
                        <wsdl:output message="tns:PolicyServicesPingDataResponse" name="PolicyServicesPingDataResponse"/>
                        <wsdl:fault message="tns:PolicyServicesPingDataFault" name="PolicyServicesPingDataFault"/>
                </wsdl:operation>
        </wsdl:portType>
        <wsdl:binding name="PolicyServicesPingSOAP" type="tns:PolicyServicesPing">
                <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
                <wsdl:operation name="PolicyServicesPingData">
                        <soap:operation soapAction="http://www.westernsouthernlife.com/PolicyServicesPing/PolicyServicesPingData"/>
                        <wsdl:input name="PolicyServicesPingDataRequest">
                                <soap:body use="literal"/>
                        </wsdl:input>
                        <wsdl:output name="PolicyServicesPingDataResponse">
                                <soap:body use="literal"/>
                        </wsdl:output>
                        <wsdl:fault name="PolicyServicesPingDataFault">
                                <soap:fault name="PolicyServicesPingDataFault" use="literal"/>
                        </wsdl:fault>
                </wsdl:operation>
        </wsdl:binding>
        <wsdl:service name="PolicyServicesPing">
                <wsdl:port binding="tns:PolicyServicesPingSOAP" name="PolicyServicesPingSOAP">
                        <soap:address location="http://eisiibl1d:7080/wsfg/EntService/Policy/PolicyServicesPing"/>
                </wsdl:port>
        </wsdl:service>
</wsdl:definitions>
HTTP CRITICAL: HTTP/1.1 200 OK - pattern not found - 3032 bytes in 0.022 second response time |time=0.021662s;;;0.000000 size=3032B;512;0;0
Looks like the same thing as before.

Re: Monitor Web Service

Posted: Wed Jan 20, 2016 11:47 am
by rkennedy
Yeah, it appears so. This ones a bit tricky to troubleshoot on our end as there are a couple factors in play.

Code: Select all

Policy Services Ping:
Test Link: http://eisiibl1t:7080/wsfg/EntService/Policy/PolicyServicesPing?wsdl

Soap Response:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
   <soapenv:Body>
      <NS1:PolicyServicesPingDataResponse xmlns:NS1="http://www.site.com/PolicyServicesPing/">
         <NS1:policyServicesPingDataResponse>INL11D-EIS_IS-PolicyServices-UP1234</NS1:policyServicesPingDataResponse>
      </NS1:PolicyServicesPingDataResponse>
   </soapenv:Body>
</soapenv:Envelope>
Are you able to ask whomever said this would be the response, what command over the CLI they can run to produce that?

Re: Monitor Web Service

Posted: Mon Jan 25, 2016 10:06 am
by jkinning
The Developer had been off for a few days but got back to me.

Here is what he sent but that doesn't help me any with trying to make Nagios monitor this web service call. I am hoping it makes sense here. :D

Code: Select all

URL: http://eisiibl1d:7080/wsfg/EntService/Policy/PolicyServicesPing?wsdl

Request:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:pol="http://www.site.com/PolicyServicesPing/">
   <soapenv:Header/>
   <soapenv:Body>
      <pol:PolicyServicesPingData>
         <!--Optional:-->
         <pol:PolicyServicesPingRequestMessage></pol:PolicyServicesPingRequestMessage>
      </pol:PolicyServicesPingData>
   </soapenv:Body>
</soapenv:Envelope>

Response:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
   <soapenv:Body>
      <NS1:PolicyServicesPingDataResponse xmlns:NS1="http://www.site.com/PolicyServicesPing/">
         <NS1:policyServicesPingDataResponse>INL11D-EIS_IS-PolicyServices-UP1234</NS1:policyServicesPingDataResponse>
      </NS1:PolicyServicesPingDataResponse>
   </soapenv:Body>
</soapenv:Envelope>

Re: Monitor Web Service

Posted: Mon Jan 25, 2016 5:35 pm
by tmcdonald
I think you are supposed to HTTP POST the request, and compare it against the response. You should be able to post it like so:

Code: Select all

./check_http -H eisiibl1d -p 7080 -k "Content-Type: text/xml;charset=UTF-8" -k 'SOAPAction:ping' -r 'INL11D-EIS_IS-PolicyServices-UP1234' -T text/xml -t 10 -m 512 -u '/wsfg/EntService/Policy/PolicyServicesPing?wsdl' -v -P'%3Csoapenv%3AEnvelope%20xmlns%3Asoapenv%3D%22http%3A%2F%2Fschemas.xmlsoap.org%2Fsoap%2Fenvelope%2F%22%20xmlns%3Apol%3D%22http%3A%2F%2Fwww.site.com%2FPolicyServicesPing%2F%22%3E%0A%20%20%20%3Csoapenv%3AHeader%2F%3E%0A%20%20%20%3Csoapenv%3ABody%3E%0A%20%20%20%20%20%20%3Cpol%3APolicyServicesPingData%3E%0A%20%20%20%20%20%20%20%20%20%3C!--Optional%3A--%3E%0A%20%20%20%20%20%20%20%20%20%3Cpol%3APolicyServicesPingRequestMessage%3E%3C%2Fpol%3APolicyServicesPingRequestMessage%3E%0A%20%20%20%20%20%20%3C%2Fpol%3APolicyServicesPingData%3E%0A%20%20%20%3C%2Fsoapenv%3ABody%3E%0A%3C%2Fsoapenv%3AEnvelope%3E'
Note that the -P option needs to be URL-encoded as was done above.