Easy-to-use Telegram bot for publishing Prometheus metrics on a schedule.
1.9K
Telegram bot for scheduled and on-demand Prometheus statistics.
It supports:
valuegraphpiechart/current/query up/start user as administratorThe application is split into simple modules:
At startup the bot:
Access is chat-based and persisted in a JSON state file.
Rules:
/start becomes admin automatically/startAdmin commands:
/pending/approve <chat_id>/deny <chat_id>Using uv:
uv sync --group dev
Copy and edit the example config in examples/bot-config.yaml.
Full field-by-field documentation is available in docs/configuration-reference.md.
At minimum set:
prometheus.base_urlaccess_control.state_fileTelegram token resolution order:
TELEGRAM_BOT_TOKEN from the process environmentTELEGRAM_BOT_TOKEN loaded from a .env file if the environment variable is not already settelegram.bot_token from YAML configThe loader checks .env in:
You can start from .env.example.
Using the packaged CLI:
uv run prometheus-telegram-bot --config examples/bot-config.yaml
Using the local example runner:
uv run python examples/main.py
Or with an explicit config path:
uv run python examples/main.py --config examples/bot-config.yaml
The image is generic and does not bundle example config files.
Container contract:
prometheus-telegram-bot--config /path/to/config.yamlTELEGRAM_BOT_TOKEN via environment or mounted .envSee examples/docker-compose.yml.
Run:
docker compose -f examples/docker-compose.yml up -d --build
The sample compose file mounts:
/config/bot-config.yaml/datadocker rundocker run -d \
--name prometheus-telegram-bot \
-v $(pwd)/config.yaml:/config/config.yaml:ro \
-v $(pwd)/data:/data \
andreybolut/prometheus-telegram-bot:latest \
--config /config/config.yaml
See the full configuration reference in docs/configuration-reference.md.
Quick pointers:
access_control.state_file under /dataTypical flow:
/start/start/approve <chat_id>Example user commands:
/start/help/current/random_graph/system_graph/health/query upuv run pytest
uv run pre-commit install
Run lint manually with:
uv run ruff check .
Current tests cover:
graph publishers use Prometheus range queriesvalue and piechart publishers use instant queriesaccess_control.state_fileReleased under the MIT License.
Content type
Image
Digest
sha256:d0e958e71…
Size
99.2 MB
Last updated
7 months ago
docker pull andreybolut/prometheus-telegram-bot