72 lines
1.7 KiB
Markdown
72 lines
1.7 KiB
Markdown
# 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
|
|
|
|
```bash
|
|
python -m venv .venv
|
|
source .venv/bin/activate
|
|
pip install -r req.txt
|
|
```
|
|
|
|
## Configure
|
|
|
|
1. Copy the example config:
|
|
|
|
```bash
|
|
cp config.example.yaml config.yaml
|
|
```
|
|
|
|
2. Edit `config.yaml` and set at least:
|
|
|
|
- `telegram.token`
|
|
- `telegram.admin_id`
|
|
|
|
3. 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
|
|
|
|
```bash
|
|
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.
|
|
- Audit log default path is `/var/server-bot/audit.log`.
|