Monitor Web Service

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
jkinning
Posts: 747
Joined: Wed Oct 09, 2013 2:54 pm

Monitor Web Service

Post by jkinning »

I am trying to get several web service checks working and I am not getting too far. I am working with the Application support person but not getting too far with him either. I have a web service call I am currently using which looks like this.

Code: Select all

[nagios@ libexec]$ ./check_http -H eisiibl1s -p 7080 -k 'SOAPAction:ping' -r 'GetCRMPolicyDetail-UP1234' -T text/xml -t 10 -m 512 -u '/wsfg/EntService/GetCRMPolicyDetail/GetCRMPolicyDetailPing?wsdl' -v -P'<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:agr="http://www.westernsouthernlife.com/GetCRMPolicyDetailPing/"><soapenv:Header/><soapenv:Body><agr:GetCRMPolicyDetailPingData><agr:GetCRMPolicyDetailPingRequestMessage>?</agr:GetCRMPolicyDetailPingRequestMessage></agr:GetCRMPolicyDetailPingData></soapenv:Body></soapenv:Envelope>'
POST /wsfg/EntService/GetCRMPolicyDetail/GetCRMPolicyDetailPing?wsdl HTTP/1.1
User-Agent: check_http/v2.0.3 (nagios-plugins 2.0.3)
Connection: close
Host: eisiibl1s:7080
Accept: */*
SOAPAction:ping
Content-Type: text/xml
Content-Length: 363

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:agr="http://www.westernsouthernlife.com/GetCRMPolicyDetailPing/"><soapenv:Header/><soapenv:Body><agr:GetCRMPolicyDetailPingData><agr:GetCRMPolicyDetailPingRequestMessage>?</agr:GetCRMPolicyDetailPingRequestMessage></agr:GetCRMPolicyDetailPingData></soapenv:Body></soapenv:Envelope>

http://eisiibl1s:7080/wsfg/EntService/GetCRMPolicyDetail/GetCRMPolicyDetailPing?wsdl is 595 characters
STATUS: HTTP/1.1 200 OK
**** HEADER ****
Server: Apache-Coyote/1.1
Content-Type: text/xml;charset=utf-8
Content-Length: 434
Date: Wed, 26 Jul 2017 13:17:02 GMT
Connection: close
**** CONTENT ****
<?xml version="1.0" encoding="utf-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><NS1:GetCRMPolicyDetailPingDataResponse xmlns:NS1="http://www.westernsouthernlife.com/GetCRMPolicyDetailPing/"><NS1:GetCRMPolicyDetailPingDataResponse>INL11S-EIS_IS-GetCRMPolicyDetail-UP1234</NS1:GetCRMPolicyDetailPingDataResponse></NS1:GetCRMPolicyDetailPingDataResponse></soapenv:Body></soapenv:Envelope>
HTTP OK: HTTP/1.1 200 OK - 595 bytes in 0.131 second response time |time=0.130759s;;;0.000000 size=595B;512;0;0
Trying to use somewhat the same format with one of these new checks things are not working. We are both lost so looking for some suggestions on what we are doing wrong.

Code: Select all

[nagios@ libexec]$ ./check_http -H satmr1t -p 8080 -s '<CaseStatusCode>Complete</CaseStatusCode>' -T text/xml -t 10 -m 512 -u '/SuitabilityServices/FormService.svc' -v -P'<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:suit"http://ws.wsfgrp.net/2011/06/SuitabilityServices"><soapenv:Header/><soapenv:Body><suit:ReviewStatusCheckRequest><suit:FormId>3</suit:FormId></suit:ReviewStatusCheckRequest></soapenv:Body></soapenv:Envelope>'
POST /SuitabilityServices/FormService.svc HTTP/1.1
User-Agent: check_http/v2.0.3 (nagios-plugins 2.0.3)
Connection: close
Host: satmr1t:8080
Accept: */*
Content-Type: text/xml
Content-Length: 293

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:suit"http://ws.wsfgrp.net/2011/06/SuitabilityServices"><soapenv:Header/><soapenv:Body><suit:ReviewStatusCheckRequest><suit:FormId>3</suit:FormId></suit:ReviewStatusCheckRequest></soapenv:Body></soapenv:Envelope>

http://satmr1t:8080/SuitabilityServices/FormService.svc is 153 characters
STATUS: HTTP/1.1 400 Bad Request
**** HEADER ****
Server: Microsoft-IIS/7.5
X-Powered-By: ASP.NET
Date: Wed, 26 Jul 2017 13:12:50 GMT
Connection: close
Content-Length: 0
**** CONTENT ****

HTTP CRITICAL: HTTP/1.1 400 Bad Request - string '<CaseStatusCode>Complete</...' not found on 'http://satmr1t:8080/SuitabilityServices/FormService.svc', page size 153 too small - 153 bytes in 0.007 second response time |time=0.006593s;;;0.000000 size=153B;512;0;0

I have tried using the -k 'TT:CLIC bait' but that just makes things appear worse.

Code: Select all

[nagios@nagiosl1p libexec]$ ./check_http -H satmr1t -p 8080 -k 'TT:CLIC bait' -r '<CaseStatusCode>Complete</CaseStatusCode>' -T text/xml -t 10 -m 512 -u '/SuitabilityServices/FormService.svc' -v -P'<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tra="http://ws.wsfgrp.net/2011/06/TrainingServices"><soapenv:Header/><soapenv:Body><tra:TrainingCheckRequest><tra:AppId>CM5086440A</tra:AppId><tra:CompanyCode>WSCLIC</tra:CompanyCode><tra:ProductId>ADVANT</tra:ProductId><tra:StateCode>WV</tra:StateCode><tra:AppSignedDate>2015-09-28</tra:AppSignedDate><tra:InitialPremium>640000</tra:InitialPremium><tra:Reps><tra:Rep><!--Optional:--><tra:FirmId>?</tra:FirmId><tra:RepId>CL00053195</tra:RepId></tra:Rep></tra:Reps><tra:SystemId>SoapUi-CLICtest</tra:SystemId> </tra:TrainingCheckRequest></soapenv:Body></soapenv:Envelope>'
POST /SuitabilityServices/FormService.svc HTTP/1.1
User-Agent: check_http/v2.0.3 (nagios-plugins 2.0.3)
Connection: close
Host: satmr1t:8080
Accept: */*
TT:CLIC bait
Content-Type: text/xml
Content-Length: 652

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tra="http://ws.wsfgrp.net/2011/06/TrainingServices"><soapenv:Header/><soapenv:Body><tra:TrainingCheckRequest><tra:AppId>CM5086440A</tra:AppId><tra:CompanyCode>WSCLIC</tra:CompanyCode><tra:ProductId>ADVANT</tra:ProductId><tra:StateCode>WV</tra:StateCode><tra:AppSignedDate>2015-09-28</tra:AppSignedDate><tra:InitialPremium>640000</tra:InitialPremium><tra:Reps><tra:Rep><!--Optional:--><tra:FirmId>?</tra:FirmId><tra:RepId>CL00053195</tra:RepId></tra:Rep></tra:Reps><tra:SystemId>SoapUi-CLICtest</tra:SystemId> </tra:TrainingCheckRequest></soapenv:Body></soapenv:Envelope>

http://satmr1t:8080/SuitabilityServices/FormService.svc is 902 characters
STATUS: HTTP/1.1 500 Internal Server Error
**** HEADER ****
Content-Length: 698
Content-Type: text/xml; charset=utf-8
Server: Microsoft-IIS/7.5
X-Powered-By: ASP.NET
Date: Wed, 26 Jul 2017 13:20:12 GMT
Connection: close
**** CONTENT ****
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Body><s:Fault><faultcode xmlns:a="http://schemas.microsoft.com/ws/2005/05/addressing/none">a:ActionNotSupported</faultcode><faultstring xml:lang="en-US">The message with Action '' cannot be processed at the receiver, due to a ContractFilter mismatch at the EndpointDispatcher. This may be because of either a contract mismatch (mismatched Actions between sender and receiver) or a binding/security mismatch between the sender and the receiver.  Check that sender and receiver have the same contract and the same binding (including security requirements, e.g. Message, Transport, None).</faultstring></s:Fault></s:Body></s:Envelope>
HTTP CRITICAL: HTTP/1.1 500 Internal Server Error - pattern not found - 902 bytes in 0.005 second response time |time=0.005167s;;;0.000000 size=902B;512;0;0
Here was one bit of information that was passed along to me.

Code: Select all

-H 'http://satmr1t' -p 8080
-u '/SuitabilityServices/FormService.svc'
-k 'TT:CLIC bait'
-T text/xml -t 10 -m 512 -v

-P'<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:suit="http://ws.wsfgrp.net/2011/06/SuitabilityServices">
   <soapenv:Header/>
   <soapenv:Body>
      <suit:ReviewStatusCheckRequest>
         <suit:FormId>3</suit:FormId>
      </suit:ReviewStatusCheckRequest>
   </soapenv:Body>
</soapenv:Envelope>'
-s or --expect  (or regex)
    <CaseStatusCode>Complete</CaseStatusCode>
    <LastReviewTypeCode>Director</LastReviewTypeCode>
    <LastReviewStatusCode>Rejected</LastReviewStatusCode>
User avatar
cdienger
Support Tech
Posts: 5045
Joined: Tue Feb 07, 2017 11:26 am

Re: Monitor Web Service

Post by cdienger »

The 500 response indicates that the request was received but the destination didn't like the request. Assuming the information you were given about making the request is correct, it looks like something on the endpoint needs to be configured:

Code: Select all

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Body><s:Fault><faultcode xmlns:a="http://schemas.microsoft.com/ws/2005/05/addressing/none">a:ActionNotSupported</faultcode><faultstring xml:lang="en-US">The message with Action '' cannot be processed at the receiver, due to a ContractFilter mismatch at the EndpointDispatcher. This may be because of either a contract mismatch (mismatched Actions between sender and receiver) or a binding/security mismatch between the sender and the receiver.  Check that sender and receiver have the same contract and the same binding (including security requirements, e.g. Message, Transport, None).</faultstring></s:Fault></s:Body></s:Envelope>
That said, the TT header looks manditory so I would continue to test with that. I don't think this has any impact, but headers usually have a space between the colon and the value. Try:

Code: Select all

./check_http -H satmr1t -p 8080 -k 'TT: CLIC bait' -s '<CaseStatusCode>Complete</CaseStatusCode>' -T text/xml -t 10 -m 512 -u '/SuitabilityServices/FormService.svc' -v -P'<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:suit"http://ws.wsfgrp.net/2011/06/SuitabilityServices"><soapenv:Header/><soapenv:Body><suit:ReviewStatusCheckRequest><suit:FormId>3</suit:FormId></suit:ReviewStatusCheckRequest></soapenv:Body></soapenv:Envelope>'
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
jkinning
Posts: 747
Joined: Wed Oct 09, 2013 2:54 pm

Re: Monitor Web Service

Post by jkinning »

Bad Request

Code: Select all

./check_http -H satmr1t -p 8080 -k 'TT: CLIC bait' -s '<CaseStatusCode>Complete</CaseStatusCode>' -T text/xml -t 10 -m 512 -u '/SuitabilityServices/FormService.svc' -v -P'<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:suit"http://ws.wsfgrp.net/2011/06/SuitabilityServices"><soapenv:Header/><soapenv:Body><suit:ReviewStatusCheckRequest><suit:FormId>3</suit:FormId></suit:ReviewStatusCheckRequest></soapenv:Body></soapenv:Envelope>'
POST /SuitabilityServices/FormService.svc HTTP/1.1
User-Agent: check_http/v2.0.3 (nagios-plugins 2.0.3)
Connection: close
Host: satmr1t:8080
Accept: */*
TT: CLIC bait
Content-Type: text/xml
Content-Length: 293

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:suit"http://ws.wsfgrp.net/2011/06/SuitabilityServices"><soapenv:Header/><soapenv:Body><suit:ReviewStatusCheckRequest><suit:FormId>3</suit:FormId></suit:ReviewStatusCheckRequest></soapenv:Body></soapenv:Envelope>

http://satmr1t:8080/SuitabilityServices/FormService.svc is 153 characters
STATUS: HTTP/1.1 400 Bad Request
**** HEADER ****
Server: Microsoft-IIS/7.5
X-Powered-By: ASP.NET
Date: Wed, 26 Jul 2017 17:05:23 GMT
Connection: close
Content-Length: 0
**** CONTENT ****

HTTP CRITICAL: HTTP/1.1 400 Bad Request - string '<CaseStatusCode>Complete</...' not found on 'http://satmr1t:8080/SuitabilityServices/FormService.svc', page size 153 too small - 153 bytes in 0.004 second response time |time=0.003933s;;;0.000000 size=153B;512;0;0
So, does that mean they need to add something in their soap call so Nagios can validate it?
User avatar
cdienger
Support Tech
Posts: 5045
Joined: Tue Feb 07, 2017 11:26 am

Re: Monitor Web Service

Post by cdienger »

With the 500 error I would say so, but the 400 error is usually seen if there is a problem with the actual http request not conforming to an rfc standard - although I don't see any problem with it currently. I'd like to get a tcpdump while you run the command again:

Code: Select all

yum -y install tcpdump
tcpdump -s 0 -i any host ip_addr_of_destination and port 8080 -w webservice.pcap
Use ctrl+c to stop the dump after reproducing the error. The file can be reviewed with wireshak. Feel free to attach it to the thread or PM it to me.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
User avatar
cdienger
Support Tech
Posts: 5045
Joined: Tue Feb 07, 2017 11:26 am

Re: Monitor Web Service

Post by cdienger »

Thanks for the capture! The request looks good. I would suggest reviewing https://docs.microsoft.com/en-us/iis/tr ... ors-in-iis to troubelshoot on the IIS side. Specifically, you should check the rules that HTTP.sys in enforcing and also the httperr.log.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Locked