drewkerrigan/nagios-http-json

How to parse 0.0 values

Closed this issue · 1 comments

HI

with -d option i get

'memory': [{'availableBytes': 5988585472.0,

how to set -c value to get alarm when the value is minor than 59885854

And how can set a -c values when the exit has a string value

'processName': 'ininedgecontrol'},

i need a alert when the ininedgecontro does not exists

Thanks for your help

Hi,

I hope this example is what you are looking for:

curl http://localhost:8000/bytes.json 
[
  {
  "memory": [{"availableBytes": 500.123}]
  },
  {
  "memory": [{"availableBytes": 100.123}]
  },
  {
  "memory": []
  }
]

Float values should work as expected:

./check_http_json.py -H localhost:8000 -p bytes.json -c "(0).memory(0).availableBytes,500.122"
CRITICAL: Status CRITICAL. Value (500.123) for key (0).memory(0).availableBytes was outside the range 0:500.122.

./check_http_json.py -H localhost:8000 -p bytes.json -c "(0).memory(0).availableBytes,500.200"
OK: Status OK.

The -E flag can be used to check if keys are present:

 ./check_http_json.py -H localhost:8000 -p bytes.json -E "(0).memory(0).availableBytes"       
OK: Status OK.

 ./check_http_json.py -H localhost:8000 -p bytes.json -E "(1).memory(0).availableBytes"
OK: Status OK.

./check_http_json.py -H localhost:8000 -p bytes.json -E "(2).memory(0).availableBytes"
CRITICAL: Status CRITICAL. Key (2).memory(0).availableBytes did not exist.