Looking to use the nagios plugin nagios-http-json https://github.com/drewkerrigan/nagios-http-json to check a json response.
There is an example (I slightly modified):
Data for keys ring_members(0).numberToCheck, ring_members(1).numberToCheck, ring_members(2).numberToCheck:
{
"ring_members": [
{"numberToCheck": "10"},
{"numberToCheck": "20"},
{"numberToCheck": "30"}
]
}
If I want to check the first element in the response's array I could write:
plugins/check_http_json.py .... -w ring_members(0).numberToCheck,@20:
To check if ring_members position 0 key numberToChecks value is greater than or equal to 20 and flag a warning if true.
I could repeat -w ring_members(0).numberToCheck,@20: ring_members(1).numberToCheck,@20: ... to check all the values.
However is it possible to check each position of ring_members, when the length of ring_members is unknown?