https://github.com/znerol/grafana-pdf-proxy
Connects to a Grafana instance and renders a PDF for the given URL
https://github.com/znerol/grafana-pdf-proxy
Last synced: 2 months ago
JSON representation
Connects to a Grafana instance and renders a PDF for the given URL
- Host: GitHub
- URL: https://github.com/znerol/grafana-pdf-proxy
- Owner: znerol
- License: agpl-3.0
- Created: 2021-10-22T15:44:43.000Z (over 4 years ago)
- Default Branch: develop
- Last Pushed: 2021-12-12T11:11:58.000Z (over 4 years ago)
- Last Synced: 2025-01-27T06:28:22.395Z (over 1 year ago)
- Language: JavaScript
- Size: 24.4 KB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: COPYING
Awesome Lists containing this project
README
Grafana PDF Proxy
=================
Connects to a Grafana instance and renders a PDF for the given URL.
This work is based on [a gist by svet-b](https://gist.github.com/svet-b/1ad0656cd3ce0e1a633e16eb20f66425).
Installation
------------
```
npm install
```
Optionally skip installation of `chromium` by puppeteer.
```
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true npm install
```
Environment
-----------
`GRAFANA_PDF_BIND_PORT`: Specify the port on which the proxy is listening. No
default, the operation system will pick a random port if this variable is not
defined.
`GRAFANA_PDF_BIND_HOST`: Specify the IP address on which the proxy is
listening. Defaults to `::1`. Use `::` in order to expose the proxy to the
world.
`GRAFANA_PDF_BACKEND_URL`: URL prefix of grafana. Trailing slash should be
omitted. Defaults to `http://localhost:3000`.
`GRAFANA_PDF_BACKEND_USER`: Name of a user with `view` privileges to the
desired dashboard. No authentication is attempted if omitted.
`GRAFANA_PDF_BACKEND_PASS`: Password of the user. No authentication is
attempted if omitted.
`GRAFANA_PDF_CHROME_PATH`: Path to a chrome/chromium executable. Puppeteer uses
a builtin chrome if omitted.
Running
-------
```
node index.js
```
Test using curl (assuming the server is running on localhost, on port 38269,
and the path to the dashboard is `/d/GN7k2MI3D/nodes?orgId=1`):
```
curl -o /tmp/test.pdf 'http://[::1]:38269/d/GN7k2MI3D/nodes?orgId=1'
```
License
-------