drewkerrigan / nagios-http-json

A generic plugin for Nagios which checks json values from a given HTTP endpoint against argument specified rules and determines the status and performance data for that service.
Other
67 stars 60 forks source link

Need help. #29

Closed metabsd closed 4 years ago

metabsd commented 7 years ago

It's possible to handle that type of json response ?

./check_http_json.py -d -s -H test.service-now.com -p "/api/now/table/ecc_agent?sysparm_query=name=aname&sysparm_fields=status&sysparm_view=" -B "username:Passw0rd" -c "????" url:https://test.service-now.com//api/now/table/ecc_agent?sysparm_query=name=aname&sysparm_fields=status&sysparm_view= json: {u'result': [{u'status': u'Up'}]} rules:Namespace(auth='username:Passw0rd', data=None, debug=True, headers=None, host='test.service-now.com', key_list=None, key_list_critical=None, key_threshold_critical=['result.status,Up'], key_threshold_warning=None, key_value_list=None, key_value_list_critical=None, metric_list=None, path='/api/now/table/ecc_agent?sysparm_query=name=aname&sysparm_fields=status&sysparm_view=', port=None, separator=None, ssl=True, timeout=None) separator:. OK: Status OK.

The response of ServiceNOW is {u'result': [{u'status': u'Up'}]} and I want to setup critical if status is Up for testing.

Thank you!!!

NicolaiSoeborg commented 7 years ago

{u'result': [{u'status': u'Up'}]} is invalid json.

If the response is: {"result": [{"status": "Up"}]} then -Q "result.(0).status,Up" should do the trick :-)

martialblog commented 4 years ago

Closing this due to inactivity. Please reopen if this still is an issue