dbf9b1fd2f0832834b07292dba79bb5551648298
tg-admin-bot
Telegram admin bot for Linux servers. Provides quick status checks, backup controls, and ops actions from a chat.
Features
- Docker: status, restart, logs (tail, since, filter).
- Arcane: list projects, refresh, up/down, restart.
- Backups (restic): snapshots, repo stats, run backup, queue, restic check, weekly report.
- System: disks, security, URLs health, metrics, package updates, upgrade, reboot, hardware info, SSL cert status (NPMplus).
- Alerts: disk/load and SMART monitoring with cooldown.
- Audit log: all button presses and messages (weekly rotation).
Requirements
- Linux host.
- Python 3.11+ (tested with 3.13).
- System tools as needed:
- docker
- restic
- smartctl (smartmontools)
- sudo access for reboot/upgrade/backup scripts
- systemd (for timers/status, optional but recommended)
Install
python -m venv .venv
source .venv/bin/activate
pip install -r req.txt
Configure
- Copy the example config:
cp config.example.yaml config.yaml
- Edit
config.yamland set at least:
telegram.tokentelegram.admin_id
- Optional:
- Restic env file path (
paths.restic_env). - Docker autodiscovery or explicit
docker.containers. - Arcane and NPMplus API settings.
- Audit log path and rotation.
See CONFIG.en.md for full details.
Run
python bot.py
License
Copyright (C) 2026 benya
GNU GPL v3.0. Full text in LICENSE.
Notes
- For NPMplus with self-signed TLS, set
npmplus.verify_tls: false. - The bot uses
sudofor certain actions (reboot, upgrade, backup scripts). Ensure the service user has the required permissions. - Audit log default path is
/var/server-bot/audit.log.
Languages
Python
99.9%