Download Grafana panel image by using Grafana Image Renderer plugin and send it to Telegram chat or channel.
$ pip install requests
$ pip install pillow
$ pip install python-telegram-bot==13.15
Grafana Image Renderer must be installed before using the tool. Please read Plugin installation instruction carefully, especially if you are going to use Grafana Docker image.
Please use the following instruction to run Grafana Docker image with the plugin installed. The instruction is working pretty well with Grafana 9.3.2 and latest Dockerfile
Please generate API Key for the tool.
Navigate: Configuration -> API Keys menu
Configuration can be specified via settings.ini file.
Specify Grafana host, port and api key
Specify settings and panel to render:
DASHBOARD_UID
- copy from dashboard url or dashboard json. PANEL_ID
- copy from panel view url or panel json.FROM_DATE
- recommendation is using quick ranges (example: now-1d etc.) or convert datetime to milliseconds TO_DATE
- recommendation is using quick ranges (example: now etc.) or convert datetime to millisecondsORG_ID
- copy from panel view urlWIDTH
, HEIGHT
, TZ
- as you wish
Specify file path to save rendered image. Note: Directory must be created.
Specify settings to add watermark on panel image:
TEXT
- watermark text. Keep empty to disable functionality.FONT
and FONT_SIZE
- text font settings. MARGIN
- margin size for watermark
Specify settings to send image to Telegram chat or channel:
BOT_TOKEN
- telegram bot token.CHAT_ID
- id of chat or channel. IMAGE_DESCRIPTION
- optional description for image--dashboard
- dashboard uid--panel
- panel id--f
- from date--t
- to date--file
- path to fileWatermark is optional and can be disabled if TEXT
(watermark text) is empty.
Watermark is drawing in the bottom right corner.
Telegram is optional and can be disabled if BOT_TOKEN
and\or CHAT_ID
are empty.
Telegram bot can be easily created in a few seconds via @BotFather.
Please note the easiest way to find chat_id.
All logs are written in logs/downloader.log. Any kind of settings can be changed in main.py code
The author is not responsible for any errors or omissions obtained from the use of this tool.