2

I'm looking for a way to generate an arbitrary graph from the Grafana API, ideally by just feeding it a query. After looking in the doc I don't see anything to do it directly, so the only way I can see would be to :

  • Generate a dashboard json with just the graph I want
  • Create the dashboard through the API by sending that json
  • Export that graph as jpg
  • Delete this darshboard

That seems a bit silly, isn't there a way to just generate a graph from a specific query directly ? The goal here is to add a graph in our monitoring alerts, that way if we get a high load alert on a server for example I could generate a query to get that server's load graph, and include that in the alert e-mail. Nothing life changing, but it would be a nice feature to have I think.

Ulrar
  • 367
  • 4
  • 22

1 Answers1

0

You can render a graphic in this way:

http://[grafana-url]/render/dashboard-solo/db/[dashboard_name]?panelId=[number_panel]&?from=now-24h?to=now

You can change from and to.

If you use authentication you have to use Authorization Bearer and maybe base64encode for result from query.

I hope it helps.

Paul Haldane
  • 4,457
  • 1
  • 20
  • 31
Jan
  • 31
  • 2
  • 2
    Thanks, I found that somewhere since. It's not really what I'm looking for because for that to work the dashboard has to exist, and I don't really feel like creating 600 dashboards, but it might be of use someday for something else I suppose :) – Ulrar Jun 20 '17 at 13:48