HTTP CRITICAL: Status line output matched pattern not found

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
kaushalshriyan
Posts: 124
Joined: Fri May 22, 2015 7:12 am

HTTP CRITICAL: Status line output matched pattern not found

Post by kaushalshriyan »

Hi,

I'm using check_http plugin for nagios alerting. Till now, i was using the http status code to raise the alerts.
but recently, i was asked to verify some json http response along with the http status code where i need to modify my nrpe.cfg file.

check_http -H xxxxx.xxx -S -k 'Host: xxxx.xxx' -k 'Test: Test' -p 443 -j POST -T 'application/x-www-form-urlencoded' -P 'name:xyz' -a 'xyz123:123xyz' -u '/a/b/c?Redirect_URL=https://www.google.com/' -e 'HTTP/1.1 200 OK' -f follow -l -r 'operator:t-mobile'


Here the issue i face is, i am able to detect the status code, but i am not able to match the regex pattern which i get in http response(JSON)

Sample response suing the curl is :

{
"a": 12332423452,
"response": {
"test": "test1",
"abc": "abc",
"operator": "t-mobile",
"country": "india",
"currency": "Rupee",
},
"id": "419E2BD429C1C8E7459911268513C9B5EE3C2AD0E4BE5C528952D6A89DE8D6E2C6623494ADA60C1AAF0462C30CB71874D86D1CFEBEBE26E59DA9654B5ABC9E0916CCD5D88097163AC9ED87B43E00549A86C818700C5B3E561CF0AB9ADC0AB7FA9C072175B4495034CF7F3313CA8D154DA086F9B86EFF3212"
}


I even tried using the -s flag where we can use expected string, but the id field in the response will keep changing, which made me to check for regex.

Output: HTTP CRITICAL: Status line output matched "HTTP/1.1 200 OK" - HTTP/1.1 200 OK - pattern not found - 9987 bytes in 0.938 second response time |time=0.938158s;;;0.000000 size=9987B;;;0

Any help will be highly appreciated. Thanks in Advance.

Best Regards,

Kaushal
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: HTTP CRITICAL: Status line output matched pattern not fo

Post by ssax »

Does this work for you?

Code: Select all

check_http -H xxxxx.xxx -S -k 'Host: xxxx.xxx' -k 'Test: Test' -p 443 -j POST -T 'application/x-www-form-urlencoded' -P 'name:xyz' -a 'xyz123:123xyz' -u '/a/b/c?Redirect_URL=https://www.google.com/' -e 'HTTP/1.1 200 OK' -f follow -l -s '"operator": "t-mobile"'
kaushalshriyan
Posts: 124
Joined: Fri May 22, 2015 7:12 am

Re: HTTP CRITICAL: Status line output matched pattern not fo

Post by kaushalshriyan »

Hi ssax,

It does not work. The http response code in JSON format are as below

Code: Select all

{"ttl":1541639699,"response":{"client_id":"x-test123","client_secret":"x-testsecret123","serving_operator":"t-mobile","country":"US","currency":"Dollar","apis":{"operatorid":{"link":[{"href":"http://us.gateway.wso2tel.com/authorize/v1/t-mobile/oauth2/authorize","rel":"authorization"},{"href":"https://us.gateway.wso2tel.com/token/v1/t-mobile/oauth2/token","rel":"token"},{"href":"https://us.mconnect.wso2tel.com/oauth2/userinfo?schema=openid","rel":"userinfo"}]}}},"subscriber_id":"8AAE599C97A229BC274CE06D9D9FB09BC5D12215CA87E5EEAFE9208AC96878A2CB0158E36993ABE21C55D7624E8517918AA92DC471C9C47EBF0EEA8E8C1F17C87D24CD2B4568C381DDEDC9BDAD14F64BBAF31557A534219F11192FCD7C0EB17890A88DBAFC65D7207375ED518F1845A65DBBEC2706E0B4528E7187C6E03457177D03A62E15C2666F20A0B01ED84A6E5D22C8E04985A9F7ABE86588CDAAEA287470E406D37BAE03BE65A430D891D8C12A1761740BC2B9953AF7B5ADF9C405806A482597C2C86679BBB8EBFE8C5462E8497B28423677D4DDF4DA7ECDF6F6DE79820BF8BC1EAE961078FCEE8FC17DFD9829AC715AD057EB3E413912712D82C8A803"}
Please suggest further.

Best Regards,

Kaushal
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: HTTP CRITICAL: Status line output matched pattern not fo

Post by ssax »

What about this one:

Code: Select all

check_http -H xxxxx.xxx -S -k 'Host: xxxx.xxx' -k 'Test: Test' -p 443 -j POST -T 'application/x-www-form-urlencoded' -P 'name:xyz' -a 'xyz123:123xyz' -u '/a/b/c?Redirect_URL=https://www.google.com/' -e 'HTTP/1.1 200 OK' -f follow -l -s 'operator":"t-mobile'
kaushalshriyan
Posts: 124
Joined: Fri May 22, 2015 7:12 am

Re: HTTP CRITICAL: Status line output matched pattern not fo

Post by kaushalshriyan »

Thanks ssax for the help and it worked.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: HTTP CRITICAL: Status line output matched pattern not fo

Post by scottwilkerson »

kaushalshriyan wrote:Thanks ssax for the help and it worked.
Great! Locking thread
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
Locked