swisstech.net

tech and photography

Dump all (most?) JMX Beans via Jolokia using just the shell and a bit of json formatting

2014-10-08

It seems jolokia doesn’t support dumping everything with just one command.

So here’s a really hacky quick and dirty way to get all information jolokia can access:

1
2
3
for name in $(curl --silent http://dwtest:10002/search/*:* | python -m json.tool | grep '"value":' -A9999 | tail -n +2 | head -n -2 | sed 's/ /%20/g' | cut -d'"' -f2);
    do curl --silent "http://dwtest:10002/read/$name" | python -m json.tool;
done

Once you’ve gotten this far, piping the information into a file or another tool is trivial.