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

Pavel Vyazankin picture Pavel Vyazankin · Sep 3, 2014 · Viewed 12.3k times · Source

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.

Answer

Krzysztof Krasoń picture Krzysztof Krasoń · Dec 21, 2016

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.