Setting up Grafana Image Renderer
This guide is tested only up to Grafana 7.5
Background
Since Grafana v7.0.0, PhantomJS support has been removed causing the image rendering of dashboard panel and alert image snapshots have been delegated out to [Grafana Image Renderer plugin] or remote rendering services.
In this guide, I am implementing a remote rendering service.
This is my consolidated notes on what you need to change and look out for.
Setup
Grafana Image Renderer
There are 2 main methods that you can use to deploy the image renderer.
The key criteria regardless of what method you choose is that the renderer needs to be network accessible by your main grafana app.
Grafana
Once your Image Renderer is deployed and in a location that is network-accessible by Grafana, you will need to make a couple of configuration changes to your grafana.ini.
If you prefer using environment variables, make sure you have these variables set (please change your values accordingly)
GF_RENDERING_SERVER_URL: http://renderer:8081/render
GF_RENDERING_CALLBACK_URL: http://grafana:3000/
or if you prefer to change your grafana.ini, you can add the following:
[rendering]
server_url = http://localhost:8081/render
callback_url = http://localhost:3000/
server_url
is meant to point to your Grafana Image Renderer, so please update the front part of the url according to your network.
callback_url
just needs to point to a url that your grafana instance is listening on. This callback url is given to Grafana Image Renderer when there’s a image rendering request so that it will know how to reach back to your grafana instance to return the rendered image.
For eg. if your image renderer lives in http://renderer.monitoring.svc and your grafana lives in http://grafana.example.com, then your configuration will look something like:
[rendering]
server_url = http://renderer.monitoring.svc/render
callback_url = http://grafana.example.com
At this point, you will also need to remember that you need to configure the following settings if not, grafana may have an issue sending the rendered snapshots as part of the alerting webhook.
Make sure you have the following configured in your grafana.ini
[server]
root_url = "http://grafana.example.com"
[external_image_storage]
provider = local
The values should be changed according to your configuration needs.
I ran into this issue when after configuring image renderer, my alerts didn’t send out the image in the webhook payload even though there was no error seen in both image-renderer and grafana’s logs.
Hope this helps!