How to export a Grafana Graph as a png image? Step 1) Create your own API Keys 2) Get the Graph URL 3) Export Command
Create your API Key
- click on the grafana icon at the top left corner and go to Admin (Main Org.) -> API Keys
- add a new key (example: name=export role=viewer)
- then you will receive your api key (eyJrIjoieDRzbjh6R1__APIKEY__joiZXhwb3J0IiwiaWQiOjF9)
Get the graph url
- click on the name of the graph you want to export to a png file
- select share and copy the url of the „direct link rendered image“ link
(http://192.168.2.132:3000/render/dashboard-solo/db/mathias?panelId=22&from=1467379241365&to=1467400841365&width=1000&height=500)
Put together your export command
You can use curl to download the image file. You will have to set a Bearer token to authenticate.
curl -H „Authorization: Bearer eyJrIjoieDRzbjh6R1__APIKEY__joiZXhwb3J0IiwiaWQiOjF9“ „http://192.168.2.132:3000/render/dashboard-solo/db/mathias?panelId=22&from=now-24h&to=now&width=1000&height=500“ > filename.png
now you can execute your own command and your png file is getting saved to your directory
Example of a exported graph
Source:
Is there any way to save whole dash board in one png
I found this request: https://github.com/grafana/grafana/issues/2085
I tried to export the whole dashboard as a png but i couldn’t find the option for it. If you share the panel you can export it as a image, but at the dashboard export options it is exactly the same mask but there is no link to export it as a image. Maybe i should try to update grafana to get the new commit.
curl -H “Authorization: Bearer eyJrIjoieDRzbjh6R1__APIKEY__joiZXhwb3J0IiwiaWQiOjF9” “http://192.168.2.132:3000/render/dashboard-solo/db/mathias?panelId=22&from=now-24h&to=now&width=1000&height=500” > filename.png
where to execute the above command?
On the shell of the system you want to save the image. (ssh connection)
I tried above, it creates a PNG but when I open it, it says that this is not a PNG file.
I am using Debian 9.
Grafana version 4.6.2
You can delete my last comment. I did not look clearly enough, I now found the correct link. Bottom left there is the „Direct link rendered image“
Thanks
Great! Thanks.
I think you also need to add username like -U admin:admin in the curl command