drewkerrigan/nagios-http-json

multiple arrays and changing parameter names

vabastiil opened this issue · 3 comments

Is there way to print out with -m parameter multiple values?

Currently following does not seem to be working:

-m "(0)_gauges_jvm.buffers.direct.capacity(0)_value,(0)_gauges_jvm.buffers.direct.capacity(1)_value" -f _

output:
'(0)_gauges_jvm.buffers.direct.capacity(0)_value'=215415(0)_gauges_jvm.buffers.direct.capacity(1)_value;0;0

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

Also it would be great if there was way to change parameter names:
'(0)_gauges_jvm.buffers.direct.capacity(0)_value' to etc "buffer_cappacity_0"

Hi @vabastiil, you can get multiple metrics by separating the field names with a space (not a comma as in your example).

Try this:

./check_http_json.py -H localhost:8000 -p test.json -m "(0)_gauges_jvm.buffers.direct.capacity(0)_value" "(0)_gauges_jvm.buffers.direct.capacity(1)_value" -f _

This is the output I get using your data:

OK: Status OK.|'(0)_gauges_jvm.buffers.direct.capacity(0)_value'=215415;0;0 '(0)_gauges_jvm.buffers.direct.capacity(1)_value'=1234;0;0 

Re: changing the parameter names; I'm not sure exactly what you mean, how would (0)_gauges_jvm.buffers.direct.capacity(0)_value programatically map to buffers_capacity_0?

Thank you! Space did the trick!

Yes. By changing the parameter names i mean - it is pretty ugly to see "(0)_gauges_jvm.buffers.direct.capacity(0)_value" as a output. It would be much nicer if it is changeable.

something like: -m "(0)_gauges_jvm.buffers.direct.capacity(0)_value">buffers_capacity_0

Output:
buffers_capacity_0=...

As of 32a8884, you should now be able to do something like:

-m "(0)_gauges_jvm.buffers.direct.capacity(0)_value>buffers_capacity_0"

To get this:

OK: Status OK.|'buffers_capacity_0'=215415;0;0