Grafana supports rendering of panels and dashboards as PNG-images.
Grafana supports automatic rendering of panels and dashboards as PNG images. This allows Grafana to automatically generate images of your panels to include in alert [Notifications]({{<relref"../alerting/notifications.md">}}).
When an image is being rendered the PNG-image is temporary written to the filesystem, i.e. a sub-directory of Grafana's [data](/installation/configuration/#data) directory named `png`.
When an image is being rendered the PNG-image is temporarily written to the file system. When an image is rendered, the PNG image is temporary written to the `png` folder in the Grafana `data` folder.
A background job runs each 10 minutes and will remove temporary images. You can configure how long time an image should be stored before being removed by configuring the [temp-data-lifetime](/installation/configuration/#temp-data-lifetime) setting.
A background job runs every 10 minutes and removes temporary images. You can configure how long an image should be stored before being removed by configuring the [temp-data-lifetime]({{<relref"/installation/configuration/#temp-data-lifetime"> }}) setting.
## Requirements
You can also render a PNG by clicking the dropdown arrow next to a panel title, then clicking **Share > Direct link rendered image**.
Rendering images may require quite a lot of memory, mainly because there are "browser instances" started in the
## Memory requirements
background responsible for the actual rendering. Further, if multiple images are being rendered in parallel it most
certainly has a bigger memory footprint. Minimum free memory recommendation is 1GB.
Depending on [rendering method](#rendering-methods) you would need that memory available in the system where the
Minimum free memory recommendation is 16GB on the system doing the rendering.
rendering process is running. For [Grafana Image renderer plugin](#grafana-image-renderer-plugin) and [PhantomJS](#phantomjs)
it's the system which Grafana is installed on. For [Remote rendering service](#remote-rendering-service) it is the system where
that's installed.
## Rendering methods
Rendering images can require a lot of memory, mainly because Grafama creates browser instances in the background for the actual rendering. If multiple images are rendered in parallel, then the rendering has a bigger memory footprint. One advantage of using the remote rendering service is that the rendering will be done on the remote system, so your local system resources will not be affected by rendering.
### Grafana image renderer plugin
## Alerting and render limits
> This plugin currently does not work if it is installed in the Grafana docker image. See [Install in Grafana docker image](#install-in-grafana-docker-image).
Alert notifications can include images, but rendering many images at the same time can overload the server where the renderer is running. For instructions of how to configure this, see [concurrent_render_limit]({{<relref"../installation/configuration/#concurrent_render_limit">}}).
The [Grafana image renderer plugin](https://grafana.com/grafana/plugins/grafana-image-renderer) is a plugin that runs on the backend and handles rendering panels and dashboards as PNG-images using headless chrome.
## Install Grafana Image Renderer plugin
You can install it using grafana-cli:
The [Grafana image renderer plugin](https://grafana.com/grafana/plugins/grafana-image-renderer) is a plugin that runs on the backend and handles rendering panels and dashboards as PNG images using headless Chrome.
```bash
To install the plugin, refer to the [Grafana Image Renderer Installation instructions](https://grafana.com/grafana/plugins/grafana-image-renderer/installation).
For further information and instructions refer to [troubleshooting](#troubleshooting) and the [plugin details](https://grafana.com/grafana/plugins/grafana-image-renderer).
## Run in custom Grafana Docker image
#### Install in Grafana docker image
We recommend setting up another Docker container for rendering and using remote rendering. Refer to [Remote rendering service](#remote-rendering-service) for instructions.
This plugin is not compatible with the current Grafana Docker image without installing further system-level dependencies. We recommend setting up another Docker container for rendering and using remote rendering, see [Remote rendering service](#remote-rendering-service) for reference.
If you still want to install the plugin in the Grafana Docker image, refer to [Build with Grafana Image Renderer plugin pre-installed]({{<relref"/installation/docker/#build-with-grafana-image-renderer-plugin-pre-installed"> }}).
If you still want to install the plugin in the Grafana docker image we provide instructions for how to build a custom Grafana image, see [Installing using Docker](/installation/docker/#custom-image-with-grafana-image-renderer-plugin-pre-installed).
## Remote rendering service
### Remote rendering service
> Requires an internet connection.
The [Grafana image renderer plugin](https://grafana.com/grafana/plugins/grafana-image-renderer) can also be run as a remote HTTP rendering service. In this setup Grafana will render an image by making a HTTP request to the remote rendering service, which in turn render the image and returns it back in the HTTP response to Grafana.
The [Grafana Image Renderer plugin](https://grafana.com/grafana/plugins/grafana-image-renderer) can also be run as a remote HTTP rendering service. In this setup, Grafana renders an image by making a HTTP request to the remote rendering service, which in turn renders the image and returns it back in the HTTP response to Grafana.
You can run the remote HTTP rendering service using Docker or as a standalone Node.js application.
You can run the remote HTTP rendering service using Docker or as a standalone Node.js application.
**Using Docker:**
### Run in Docker
The following example describes how to run Grafana and the remote HTTP rendering service in two separate docker containers using Docker Compose.
The following example shows how to run Grafana and the remote HTTP rendering service in two separate Docker containers using Docker Compose.
Create a `docker-compose.yml` with the following content.
Create a `docker-compose.yml` with the following content:
```yaml
```yaml
version:'2'
version:'2'
...
@@ -80,17 +72,17 @@ services:
...
@@ -80,17 +72,17 @@ services:
-8081
-8081
```
```
and finally run:
And then run:
```bash
```bash
docker-compose up
docker-compose up
```
```
**Running as standalone Node.js application:**
## Run as standalone Node.js application
The following example describes how to build and run the remote HTTP rendering service as a standalone node.js application and configure Grafana appropriately.
The following example describes how to build and run the remote HTTP rendering service as a standalone Node.js application and configure Grafana appropriately.
1.Git clone the [Grafana image renderer plugin](https://grafana.com/grafana/plugins/grafana-image-renderer) repository.
1.Clone the [Grafana image renderer plugin](https://grafana.com/grafana/plugins/grafana-image-renderer) Git repository.
2. Install dependencies and build:
2. Install dependencies and build:
```bash
```bash
...
@@ -102,32 +94,20 @@ yarn run build
...
@@ -102,32 +94,20 @@ yarn run build
```bash
```bash
node build/app.js server --port=8081
node build/app.js server --port=8081
```
```
3. Update Grafana configuration:
4. Update Grafana configuration:
```
```
[rendering]
[rendering]
server_url = http://localhost:8081/render
server_url = http://localhost:8081/render
callback_url = http://localhost:3000/
callback_url = http://localhost:3000/
```
```
4. Restart Grafana
5. Restart Grafana.
For further information and instructions refer to [troubleshooting](#troubleshooting) and the [plugin details](https://grafana.com/grafana/plugins/grafana-image-renderer).
### PhantomJS
> PhantomJS is deprecated since Grafana v6.4 and will be removed in a future release. Please migrate to Grafana image renderer plugin or remote rendering service.
[PhantomJS](https://phantomjs.org/) have been the only supported and default image renderer since Grafana v2.x and is shipped with Grafana.
PhantomJS binaries are included for Linux (x64), Windows (x64) and Darwin (x64). For Linux you should ensure that any required libraries, e.g. libfontconfig1, are available.
## PhantomJS
Please note that PhantomJS binaries are not included for ARM. To support this you will need to ensure that a phantomjs binary is available under tools/phantomjs/phantomjs.
> PhantomJS is deprecated since Grafana v6.4 and will be removed in a future release. Please migrate to the Grafana Image Renderer plugin or remote rendering service.
## Alerting and render limits
## Troubleshoot image rendering
Alert notifications can include images, but rendering many images at the same time can overload the server where the renderer is running. For instructions of how to configure this, see [concurrent_render_limit]({{<relref"../installation/configuration/#concurrent_render_limit">}}).
## Troubleshooting
Enable debug log messages for rendering in the Grafana configuration file and inspect the Grafana server log.
Enable debug log messages for rendering in the Grafana configuration file and inspect the Grafana server log.
...
@@ -147,11 +127,11 @@ error while loading shared libraries: libX11.so.6: cannot open shared object fil
...
@@ -147,11 +127,11 @@ error while loading shared libraries: libX11.so.6: cannot open shared object fil
```
```
In general you can use the [`ldd`](https://en.wikipedia.org/wiki/Ldd_(Unix)) utility to figure out what shared libraries
In general you can use the [`ldd`](https://en.wikipedia.org/wiki/Ldd_(Unix)) utility to figure out what shared libraries
### Grafana image renderer plugin and certificate signed by internal certificate authorities
In many cases Grafana will run on internal servers and use certificates that have not been signed by a CA ([Certificate Authority](https://en.wikipedia.org/wiki/Certificate_authority)) that is known to Chrome and therefore cannot be validated. Chrome internally uses NSS ([Network Security Services](https://en.wikipedia.org/wiki/Network_Security_Services)) for cryptogtraphic operations such as the validation of certificates.
In many cases Grafana, runs on internal servers and uses certificates that have not been signed by a CA ([Certificate Authority](https://en.wikipedia.org/wiki/Certificate_authority)) known to Chrome, and therefore cannot be validated. Chrome internally uses NSS ([Network Security Services](https://en.wikipedia.org/wiki/Network_Security_Services)) for cryptogtraphic operations such as the validation of certificates.
If you are using the Grafana image renderer with a Grafana server that uses a certificate signed by such a custom CA (for example a company-internal CA), rendering images will fail and you will see messages like this in the Grafana log:
If you are using the Grafana Image Renderer with a Grafana server that uses a certificate signed by such a custom CA (for example a company-internal CA), rendering images will fail and you will see messages like this in the Grafana log:
(The severity-level `error` in the above messages might be mis-spelled with a single `r`)
(The severity-level `error` in the above messages might be misspelled with a single `r`)
If this happens, then you have to add the certificate to the trust store. If you have the certificate file for the internal root CA in the file `internal-root-ca.crt.pem`, then use these commands to create a user specific NSS trust store for the Grafana user (`grafana` for the purpose of this example) and execute the following steps:
If this happens, then you have to add the certificate to the trust store. If you have the certificate file for the internal root CA in the file `internal-root-ca.crt.pem`, then use these commands to create a user specific NSS trust store for the Grafana user (`grafana` for the purpose of this example) and execute the following steps:
...
@@ -215,3 +179,18 @@ If this happens, then you have to add the certificate to the trust store. If you
...
@@ -215,3 +179,18 @@ If this happens, then you have to add the certificate to the trust store. If you
[root@merver ~]# certutil -d sql:/usr/share/grafana/.pki/nssdb -A -n internal-root-ca -t C -i /etc/pki/tls/certs/internal-root-ca.crt.pem
[root@merver ~]# certutil -d sql:/usr/share/grafana/.pki/nssdb -A -n internal-root-ca -t C -i /etc/pki/tls/certs/internal-root-ca.crt.pem
As a last resort, if you already have [Chrome](https://www.google.com/chrome/) or [Chromium](https://www.chromium.org/)
installed on your system, then you can configure [Grafana Image renderer plugin](#grafana-image-renderer-plugin) to use this
instead of the pre-packaged version of Chromium.
> Please note that this is not recommended, since you may encounter problems if the installed version of Chrome/Chromium is not
> compatible with the [Grafana Image renderer plugin](#grafana-image-renderer-plugin).
To override the path to the Chrome/Chromium executable, set an environment variable and make sure that it's available for the Grafana process. For example:
# Enable images in notifications {#external-image-store}
# Enable images in notifications {#external-image-store}
Grafana can render the panel associated with the alert rule as a PNG image and include that in the notification. Read more about the requirements and how to configure image rendering [here]({{<relref"../administration/image_rendering/">}}).
Grafana can render the panel associated with the alert rule as a PNG image and include that in the notification. Read more about the requirements and how to configure
Most Notification Channels require that this image be publicly accessible (Slack and PagerDuty for example). In order to include images in alert notifications, Grafana can upload the image to an image store. It currently supports
Most Notification Channels require that this image be publicly accessible (Slack and PagerDuty for example). In order to include images in alert notifications, Grafana can upload the image to an image store. It currently supports
Amazon S3, Webdav, Google Cloud Storage and Azure Blob Storage. So to set that up you need to configure the [external image uploader]({{<relref"../installation/configuration/#external-image-storage">}}) in your grafana-server ini config file.
Amazon S3, Webdav, Google Cloud Storage and Azure Blob Storage. So to set that up you need to configure the [external image uploader]({{<relref"../installation/configuration/#external-image-storage">}}) in your grafana-server ini config file.
...
@@ -226,4 +227,4 @@ It currently supports only the Prometheus Alertmanager notifier.
...
@@ -226,4 +227,4 @@ It currently supports only the Prometheus Alertmanager notifier.
# Configure the link back to Grafana from alert notifications
# Configure the link back to Grafana from alert notifications
All alert notifications contain a link back to the triggered alert in the Grafana instance.
All alert notifications contain a link back to the triggered alert in the Grafana instance.
This url is based on the [domain]({{<relref"../installation/configuration/#domain">}}) setting in Grafana.
This URL is based on the [domain]({{<relref"../installation/configuration/#domain">}}) setting in Grafana.