I have an URL I can query to make sure that my app is running properly. The results are something like below. Checking that "ok" is in the string does not tell me all is well, I need to know that it occurs 3 times.
{"host":"host-name","http":{"status":"ok"},"mysql":{"status":"ok"},"mongo":{"status":"ok"}}
I am trying the following command but I guess I'm not doing the regex properly, can someone suggest?
/usr/lib/nagios/plugins/check_http host-name -4 -w 3 -c 5 -u '/app/system/status' -r 'ok{3}' -p 8080
gives me
HTTP CRITICAL: HTTP/1.1 200 OK - pattern not found - 245 bytes in 0.011 second response time |time=0.010820s;3.000000;5.000000;0.000000 size=245B;;;0
The regex 'ok{3}' would match the letter 'o' followed by exactly 3 'k's. I don't remember how pcre-compatible nagios is, so these might work:
or
What is the point to check all services in one check? Say, httpd says goodbye and your app will not be available without it.
You can check the whole response on the page: