<div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div class="gmail_default" style="font-size:small">Hello Team, <br><br>I'm using check_http plugin for nagios alerting. Till now, i was using the http status code to raise the alerts. <br>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.</div><div class="gmail_default" style="font-size:small"><br></div><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote">check_http -H <span class="gmail_default" style="font-size:small">xxxxx.xxx</span> -S -k 'Host: <span class="gmail_default" style="font-size:small">xxxx.xxx</span>' -k 'Test: Test' -p 443 -j POST -T 'application/x-www-form-urlencoded' -P '<span class="gmail_default" style="font-size:small">name:xyz</span>' -a '<span class="gmail_default" style="font-size:small">xyz123</span>:<span class="gmail_default" style="font-size:small">123xyz</span>' -u '/<span class="gmail_default" style="font-size:small">a/b/c</span>?Redirect_URL=<a href="https://www.google.com/">https://www.google.com/</a>' -e 'HTTP/1.1 200 OK' -f follow -l -r 'operator:<span class="gmail_default" style="font-size:small">t-mobile</span>'</blockquote><blockquote style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class="gmail_quote"> </blockquote><div><br></div><div class="gmail_default">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)<br><br>Sample response suing the curl is : <br><br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">{</blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">  "a": 12332423452,</blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">  "response": {</blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">    "test": "test1",</blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">    "abc": "abc",</blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">    "operator": "t-mobile",</blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">    "country": "india",</blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">    "currency": "Rupee",</blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">  },</blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">  "id": "419E2BD429C1C8E7459911268513C9B5EE3C2AD0E4BE5C528952D6A89DE8D6E2C6623494ADA60C1AAF0462C30CB71874D86D1CFEBEBE26E59DA9654B5ABC9E0916CCD5D88097163AC9ED87B43E00549A86C818700C5B3E561CF0AB9ADC0AB7FA9C072175B4495034CF7F3313CA8D154DA086F9B86EFF3212"</blockquote><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">}</blockquote><blockquote class="gmail_quote" style="font-size:small;margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"> </blockquote></div><div><br></div><div><div class="gmail_default" style="font-size:small">I even tried using the -s flag where we can use expected string, but the id field in the response will be keep changing, which made me to check for regex. <br><b><br></b><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><b>Output: </b>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</blockquote></div><br></div><div><div class="gmail_default" style="font-size:small">Any suggestion/help would be appreciated. Thanks</div><br></div><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div><font color="#0c343d" face="verdana, sans-serif"><span style="background-color:rgb(243,243,243)">Regards,</span></font></div><div><font color="#0c343d" face="verdana, sans-serif"><span style="background-color:rgb(243,243,243)">Shijith Thomas</span></font></div><div><font color="#0c343d" face="verdana, sans-serif"><span style="background-color:rgb(243,243,243)">Bangalore, Karnataka</span></font></div><div><font color="#0c343d" face="verdana, sans-serif"><span style="background-color:rgb(243,243,243)">India</span></font></div></div></div></div></div></div></div></div></div>