Hi All, this document deals with how to configure pdf exported in grafana
Using this opensource application developed by IzakMarais , we achieved exporting pdf reports from the grafana server. Here are the following steps to follow.


Install the dependency packages

yum install texlive-pdftex texlive-latex-bin texlive-texconfig* texlive-latex* texlive-metafont* texlive-cmap* texlive-ec texlive-fncychap* texlive-pdftex-def texlive-fancyhdr* texlive-titlesec* texlive-multirow texlive-framed* texlive-wrapfig* texlive-parskip* texlive-caption texlive-ifluatex* texlive-collection-fontsrecommended texlive-collection-latexrecommended texinfo-tex

Download and install go language,

wget https://dl.google.com/go/go1.10.2.linux-amd64.tar.gz

tar -C /usr/local -xzf go1.10.2.linux-amd64.tar.gz

export PATH=$PATH:/usr/local/go/bin

Download and install the pdf reporter application

go get github.com/IzakMarais/reporter/...

go install -v github.com/IzakMarais/reporter/cmd/grafana-reporter

Now start the application by using below command


Now go to server admin- API keys and create a new key with viewer privileges.
save the token id as it’s required for next step

Now goto Grafana and choose a dashboard which you need to export into pdf.
Goto setting of the dashboard and select add new option from the links tab, configure as below

Type: Link
Url: http://{FQDN neteye server}:8686/api/v5/report/{dashboardUID}?apitoken={tokenid}

Title: PDF
Tooltip: Generate a PDF of this Dashboard
Icon: doc, to be an icon of a document.
Time range: I put mark to allow periods of time.
Variable values: Mark it to play with dates.
Open in a new tab: We mark if we want the PDF to generate it in a new tab.

Then save and continue.

Open the dashboard now you can see the there is an icon for exporting pdf reports.

Here are the parameters supported by pdf exporter

Usage of ./grafana-reporter:
-cmd_apiKey string
Grafana API key. Required (and only used) in command-line mode
-cmd_apiVersion string
Api version: [v4, v5]. Required (and only used) in command line mode, example: -apiVersion v5 (default "v5")
-cmd_dashboard string
Dashboard identifier. Required (and only used) in command-line mode
Enable command line mode. Generate report from command line without starting webserver (-cmd_enable=1)
-cmd_o string
Output file. Required (and only used) in command line mode (default "out.pdf")
-cmd_template string
Specify a custom TeX template file. Only used in command line mode, but is optional even there.
-cmd_ts string
Time span. Required (and only used) in command line mode (default "from=now-3h&to=now")
-ip string
Grafana IP and port (default "localhost:3000")
-port string
Port to serve on (default ":8686")
-proto string
Grafana Protocol. Change to 'https://' if Grafana is using https. Reporter will still serve http. (default "http://")
Check the SSL issuer and validity. Set this to false if your Grafana serves https using an unverified, self-signed certificate. (default true)
-templates string
Directory for custom TeX templates (default "templates/")

This is the sample logs while exporting the report.


aph Title:techrunnr Application Status} {Id:78 Type:singlestat Title:SLA}]}
2019/09/09 06:28:47 Downloading image 12 http://localhost:3000/render/d-solo/mmZ5WTdZk/_?from=now-6h&height=500&panelId=12&theme=light&to=now&width=1000
2019/09/09 06:28:47 Downloading image 14 http://localhost:3000/render/d-solo/mmZ5WTdZk/_?from=now-6h&height=500&panelId=14&theme=light&to=now&width=1000
2019/09/09 06:28:47 Downloading image 72 http://localhost:3000/render/d-solo/mmZ5WTdZk/_?from=now-6h&height=500&panelId=72&theme=light&to=now&width=1000
2019/09/09 06:28:47 Downloading image 64 http://localhost:3000/render/d-solo/mmZ5WTdZk/_?from=now-6h&height=500&panelId=64&theme=light&to=now&width=1000
2019/09/09 06:28:47 Downloading image 70 http://localhost:3000/render/d-solo/mmZ5WTdZk/_?from=now-6h&height=500&panelId=70&theme=light&to=now&width=1000
2019/09/09 06:28:50 Downloading image 74 http://localhost:3000/render/d-solo/mmZ5WTdZk/_?from=now-6h&height=500&panelId=74&theme=light&to=now&width=1000
2019/09/09 06:28:50 Downloading image 76 http://localhost:3000/render/d-solo/mmZ5WTdZk/_?from=now-6h&height=500&panelId=76&theme=light&to=now&width=1000
2019/09/09 06:28:51 Downloading image 80 http://localhost:3000/render/d-solo/mmZ5WTdZk/_?from=now-6h&height=150&panelId=80&theme=light&to=now&width=300
2019/09/09 06:28:51 Downloading image 52 http://localhost:3000/render/d-solo/mmZ5WTdZk/_?from=now-6h&heig ht=500&panelId=52&theme=light&to=now&width=1000
2019/09/09 06:28:52 Downloading image 54 http://localhost:3000/render/d-solo/mmZ5WTdZk/_?from=now-6h&height=500&panelId=54&theme=light&to=now&width=1000
2019/09/09 06:28:54 Downloading image 66 http://localhost:3000/render/d-solo/mmZ5WTdZk/_?from=now-6h&height=500&panelId=66&theme=light&to=now&width=1000
2019/09/09 06:28:54 Downloading image 56 http://localhost:3000/render/d-solo/mmZ5WTdZk/_?from=now-6h&height=500&panelId=56&theme=light&to=now&width=1000
2019/09/09 06:28:55 Downloading image 58 http://localhost:3000/render/d-solo/mmZ5WTdZk/_?from=now-6h&height=500&panelId=58&theme=light&to=now&width=1000
2019/09/09 06:28:55 Downloading image 81 http://localhost:3000/render/d-solo/mmZ5WTdZk/_?from=now-6h&height=150&panelId=81&theme=light&to=now&width=300
2019/09/09 06:28:56 Downloading image 44 http://localhost:3000/render/d-solo/mmZ5WTdZk/_?from=now-6h&height=500&panelId=44&theme=light&to=now&width=1000
2019/09/09 06:28:56 Downloading image 46 http://localhost:3000/render/d-solo/mmZ5WTdZk/_?from=now-6h&height=500&panelId=46&theme=light&to=now&width=1000
2019/09/09 06:28:58 Downloading image 48 http://localhost:3000/render/d-solo/mmZ5WTdZk/_?from=now-6h&height=500&panelId=48&theme=light&to=now&width=1000
2019/09/09 06:28:59 Downloading image 50 http://localhost:3000/render/d-solo/mmZ5WTdZk/_?from=now-6h&height=500&panelId=50&theme=light&to=now&width=1000
2019/09/09 06:29:00 Downloading image 82 http://localhost:3000/render/d-solo/mmZ5WTdZk/_?from=now-6h&height=150&panelId=82&theme=light&to=now&width=300


© 2019, Techrunnr. All rights reserved.

Questions Answered
Articles Written
Overall Points

Prabhin Prabharkaran

He is Technical professional. He is a person who loves to share tricks and tips on the Internet. He Posts what he does!!


Leave a Reply