Skip to content
/ reporter Public
forked from IzakMarais/reporter

Service that generates a PDF report from a Grafana dashboard

License

Notifications You must be signed in to change notification settings

nktl/reporter

 
 

Repository files navigation

Grafana reporter

A simple http service that generates *.PDF reports from Grafana dashboards.

demo

Requirements

Runtime requirements

  • pdflatex installed and available in PATH.
  • a running Grafana instance that it can connect to

Build requirements:

Getting started

Build and run

Get the source files and dependencies:

go get github.com/izakmarais/reporter/...

Build and install:

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

Running without any flags assumes Grafana is reachable at localhost:3000:

grafana-reporter

Query available flags:

grafana-reporter --help

Generate dashboard

Endpoint

The reporter serves a pdf report on the specified port at:

/api/report/{dashBoardName}

where dashBoardName is the same name as used in the Grafana dashboard's URL. E.g. backend-dashboard from http://grafana-host:3000/dashboard/db/backend-dashboard.

Query parameters

Time span : In addition, the endpoint supports the same time query parameters as Grafana. This means that you can create a Grafana Link and enable the Time range forwarding check-box. The link will render a dashboard with your current dashboard time range.

template: Optionally specify a custom TeX template file. template=templateName implies a template file at templates/templateName.tex. The templates directory can be set with a commandline parameter. Sample extended template (enhanced.tex) is provided that utilizes all the reporter features (might require additional LaTeX modules to work)

apitoken: Optionally specify a Grafana authentication api token. Use this if you have auth enabled on Grafana.

variable: Allows to pass single variable to Grafana, in standard format compatible with dashboard links (i.e: &var-VariableName=VariableValue)

Test

The unit tests can be run using the go tool:

go get github.com/smartystreets/goconvey
go test -v github.com/izakmarais/reporter/...

or, the GoConvey webGUI:

./bin/goconvey -workDir `pwd`/src/github.com/izakmarais -excludedDirs `pwd`/src/github.com/izakmarais/reporter/tmp/

About

Service that generates a PDF report from a Grafana dashboard

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 95.8%
  • TeX 4.2%