drewkerrigan/nagios-http-json

Can't seem to handle json attribute names with dots in them

RichoDemus opened this issue · 4 comments

I'm trying to fetch data from dropwizards metrics page, this is a sample of what it looks like:

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

I've tried: ./check_http_json.py -H localhost:8081 -p metrics --key_exists gauges.jvm.buffers.direct.capacity.values
but I guess the problem is that the script thinks that jvm this is a nested structure like this:

{"guages": { "jvm": { "buffers": { etc etc

Is it possible to somehow mark that jvm.buffers.direct.capacity is a key or something?

Hi @RichoDemus, I haven't maintained this in awhile; I'll take a look now, but if you're able to fix it locally I'd be happy to merge a PR

Just commited a fix to master, see https://github.com/drewkerrigan/nagios-http-json#dropwizard--fieldnames-containing--example for a usage example.

You should be able to retry your example with the following:

./check_http_json.py -H localhost:8081 -p metrics --key_exists gauges_jvm.buffers.direct.capacity_value -f _

Fixed in eb8c927

@RichoDemus ^^, closing issue now.

Damn that was fast, thanks a bunch man I've tested it a bit and it seems to work. 🎈