
= Grafana Dashboard Reports
:description: Learn how to create, schedule, and email a PDF report from an existing Grafana dashboard in {page-component-title}.

{page-component-title} provides three templates to create a PDF report from an existing Grafana dashboard.
You can also schedule and email these PDF reports to anyone, meaning you can do the following:

* Keep staff without access to {page-component-title} informed about network performance for improved capacity planning.
* Create a permanent record of strategic information and progress over a long period of time.

The PDF report displays each of the panels from the specified dashboard, with one, two, or four panels per page, depending on the selected template.

.Example dashboard and PDF report
image::database-reports/Dashboard-pdf.png["Example of a {page-component-title} dashboard compared to the corresponding PDF report"]

== Before you begin

This feature requires {page-component-title} and an instance of Grafana with at least one dashboard and panel configured.
{page-component-title} lets you create a report for any Grafana dashboard, not just those created using the https://docs.opennms.com/grafana-plugin/latest/index.html[OpenNMS plugin for Grafana].

You must set Grafana as a data source by <<grafana-endpoint, configuring the Grafana endpoint>>.

If you are using the Docker image for Grafana, you must complete additional configuration steps.
Refer to Grafana's https://grafana.com/docs/grafana/latest/administration/image_rendering/#remote-rendering-service[Remote rendering service documentation] for more information on how to set up remote rendering.
Additional details are available on https://github.com/grafana/grafana-image-renderer#run-in-docker[GitHub].

[[grafana-endpoint]]
=== Configure Grafana endpoint

Configuring the Grafana endpoint sets Grafana as the data source for the dashboards from which you create PDFs.
Follow the steps below to configure the endpoint:

. Sign in to your Grafana instance.
. Choose menu:Configuration[API Keys, New API Key].
. Specify a key name and choose the *Viewer* role.
** Leave the *Time to Live* box blank so that the key never expires.
. Click *Add*.
. Copy the key to your clipboard.
+
image::database-reports/API-Key.png["Grafana UI displaying generated API key", 800]

** If desired, use the `curl` command provided in the API key dialog to test the key.
. In {page-component-title}, click *Add a Grafana Endpoint*:
+
image::database-reports/grafana-endpoint.png["{page-component-title} UI displaying a Grafana endpoint error", 600]

. In the *Endpoint Configuration* page, click the *plus* symbol (*+*) to add a new endpoint.
. Enter the required information.
. Click *Test Connection*.
. If the connection test passes, click *Create*.
** If the connection test fails, ensure that your configuration settings are valid and test the connection again.

You can now use {page-component-title} to create PDF reports of Grafana dashboards.

== Create dashboard report

Follow the steps below to create a PDF report based on a Grafana dashboard:

. In the {page-component-title} UI, choose menu:Dashboard[Database Reports] in the side menu.
. Under Report Templates, click *Grafana Dashboard Report <Xppp>*, where <Xppp> represents the number of panels per page you want to display.
. Under Report Parameters, specify the appropriate information (see the <<grafana-parameters, Parameters table>>). +
NOTE: The *Grafana Endpoint* is the data source.
Select a Grafana dashboard from the list.

. Click *Create Report*.
** You are prompted to save the report locally or open it.
The file is automatically saved to a folder on the {page-component-title} server.
It also appears in the UI in the *Persisted Reports* tab.
. To send the report to someone, click *Deliver This Report* and fill out the *Report Delivery Options*.
** If you select *Email Report*, specify the recipient's email address in the *Recipient* box.
Separate multiple recipient email addresses with a comma.
** You can also use a webhook to post the report to a specified URL.
. Click *Deliver Report*.
. To schedule the report for regular delivery, click *Schedule This Report*.
. Specify the report frequency (daily, days per week, and so on) and interval.
. Click *Schedule Report*.

Scheduled reports are displayed in the *Report Schedules* tab, where you can edit or delete them:

image::database-reports/PDF-Report.png["{page-component-title} UI displaying an example of a scheduled report"]

[[grafana-parameters]]
== Parameters

[caption=]
.Dashboard report customization parameters
[cols="1,3,1"]
|===
| Field | Description   | Default Value

| Title
| Report's title
| Grafana Dashboard Report

| Description
| Brief description of the report.
| _Blank_

| Time Zone
| Time zone for the data in the report.
A dropdown list provides all available options.
| _Default system time zone_

| Start Date
| Start date for the report.
| _Yesterday_

| End Date
| End date for the report.
| _Today_

| Format
| Format of the report.
A drop-down list provides all available options.
| PDF
|===
