A simple http service that generates *.PDF reports from Grafana dashboards.
Runtime requirements
pdflatex
installed and available in PATH.- a running Grafana instance that it can connect to
Build requirements:
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
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.
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)
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/