2026-02-07 22:10:08 +03:00
2026-02-07 22:10:08 +03:00
2026-02-07 22:10:08 +03:00
2026-02-08 18:51:45 +03:00
2026-02-08 18:51:45 +03:00
2026-02-07 22:10:08 +03:00
2026-02-08 02:54:09 +03:00
2026-02-08 01:33:14 +03:00
2026-02-07 22:10:08 +03:00

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/SMART with cooldown and quiet hours.
  • Audit log: all button presses and messages (weekly rotation).
  • Logs: bot log rotation and incidents.

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

  1. Copy the example config:
cp config.example.yaml config.yaml
  1. Edit config.yaml and set at least:
  • telegram.token
  • telegram.admin_id
  1. 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 sudo for certain actions (reboot, upgrade, backup scripts). Ensure the service user has the required permissions.
  • Enable safety.dry_run if you want a safe mode without actions.
  • Audit log default path is /var/server-bot/audit.log.
Description
No description provided
Readme GPL-3.0 1.1 MiB
Languages
Python 99.9%