A simple bot that watches for Systemd
services status. If it detects a service is down, it will send a message.
-
Install telethon
pip install telethon
-
Create a new Telegram application and get the API ID and API hash. Save them in an environment variable called
TG_API_ID
andTG_API_HASH
respectively. To do this, go to my.telegram.org and create a new application. -
Create a new Telegram bot and get the bot token. You can do this by following the instructions here. Save it in an environment variable called
TG_BOT_SVCWATCH
. -
Get your Telegram user ID and save it in an environment variable called
TG_USER_ID
. You can do this by sending message to userinfobot. -
Add services to watch in
services.txt
. Each service should be on a new line. -
Run the script
python3 main.py