A headless Python daemon to monitor the online status of your Discord bots and alert you via DM if any go offline.
- Periodically checks the presence status of configured bot IDs
- Logs results to both the file and the terminal
- Sends you a Discord DM if any bot is offline or unreachable
- Fully configurable via
config.yaml - Designed to run persistently via
systemdortmux
- Python 3.10+
- A monitoring bot (must be in the same server as the bots being watched)
discord.py,PyYAML
-
Clone or copy this repository
-
Create and activate a virtual environment:
python3 -m venv venv source venv/bin/activate- Install dependencies
pip install -r requirements.txt- Create and edit
config.yaml
# Discord user ID to receive alerts via DM owner_id: 0 # Time between checks in seconds interval: 300 # Watcher bot's token watcher_token: "YOUR_WATCHER_BOT_TOKEN" # Path to write logs log_path: "~/bot_watcher.log" # List of Discord bot user IDs to monitor bots: - 000000000000000000 - 111111111111111111- Run the watcher
python bot_watcher.pyCreate a systemd unit:
# /etc/systemd/system/bot-watcher.service [Unit] Description=Discord Bot Watcher Service After=network.target [Service] User=youruser WorkingDirectory=/path/to/discord-bot-watcher ExecStart=/path/to/discord-bot-watcher/venv/bin/python bot_watcher.py Restart=on-failure [Install] WantedBy=multi-user.targetEnable and start:
sudo systemctl daemon-reexec sudo systemctl daemon-reload sudo systemctl enable --now bot-watcher.service- All monitored bots must be in a shared guild with the watcher bot.
- Bots must expose presence (
presence intentenabled in developer portal)
Glory to the Machine.