drewkerrigan/nagios-http-json

json starting with square bracket

vabastiil opened this issue · 2 comments

How to access specific JSON field when json is starting with square bracket?

Example:
[
{ "gauges": { "jvm.buffers.direct.capacity": {"value": 215415}}}
]

Hello @vabastiil, I've just committed a fix that allows this behavior:

If the root of the JSON data is itself an array like the following:

[
{ "gauges": { "jvm.buffers.direct.capacity": {"value": 215415}}}
]

The beginning of the key should start with ($index) as in this example:

./check_http_json.py -H localhost:8081 -p metrics --key_exists "(0)_gauges_jvm.buffers.direct.capacity_value" -f _

Thank you for quick response!
Working great now!