Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to query data from Whisper (Graphite DB) from console?

I have configured Graphite to monitor my application metrics. And I configured Zabbix to monitor my servers CPU and other metrics. Now I want to pass some critical Graphite metrics to Zabbix to add triggers for them.

So I want to do something like

$ whisper get prefix1.prefix2.metricName
> 155

Is it possible?

P.S. I know about Graphite-API project, I don't want to install extra app.

like image 995
Pavel Vyazankin Avatar asked Sep 03 '14 19:09

Pavel Vyazankin


2 Answers

You can use the whisper-fetch program which is provided in the whisper installation package. Use it like this:

whisper-fetch /path/to/dot.wsp

Or to get e.g. data from the last 5 minutes:

whisper-fetch --from=$(date +%s -d "-5 min") /path/to/dot.wsp

Defaults will result in output like this:

1482318960  21.187000
1482319020  None
1482319080  21.187000
1482319140  None
1482319200  21.187000

You can change it to json using the --json option.

like image 168
Krzysztof Krasoń Avatar answered Nov 12 '22 11:11

Krzysztof Krasoń


OK! I found it myself: http://graphite.readthedocs.io/en/latest/render_api.html?highlight=rawJson (I can use curl and return csv or json).

Answer was found here custom querying in graphite

Also see: https://github.com/graphite-project/graphite-web/blob/master/docs/render_api.rst

like image 23
Pavel Vyazankin Avatar answered Nov 12 '22 10:11

Pavel Vyazankin