- The installation script updates Python and Python3 on the system to 3.8 version.
- Running the installation script may cause failures in your existing python scripts and virtual environments, especially after restart of these scripts. If you experience such problems, go to the Troubleshooting section.
- Installation script was primarily written for Ubuntu 18.04.6 LTS. The 3.8 Python version choice was caused by the fact that Python >= 3.9 is not supported by this OS version, while aiogram does not support Python < 3.7.
- If you do not want Python 3.8 to be installed as the main Python interpreter in your system, open install.sh script after cloning the repository and change 3.8 to any other Python >= 3.7 version.
Go to @BotFather and create a new bot.
Make sure, you read our notice before running commands below
cd ~
git clone https://github.com/nawinds/systemd_services_monitoring.git
cd systemd_services_monitoring
sudo chmod +x install.sh
./install.sh
After running install.sh
you will be asked to enter your bot token that you have got at
@BotFather.
After that, enter bot admin IDs, dividing them with
comma (e.g. 873847924,673435489,7674387483
or 873847924
)
After the install.sh
script finishes, modify systemd services that you would like
to add to the monitoring system.
Add OnFailure=on-failure.service
directive inside [Unit]
module
of service configuration file. Remember to remove all other restart-on-fail
directives from these services. The monitoring system automatically
restarts failed services.
Do not forget to run sudo systemctl daemon-reload
after editing your services.
Go to your Telegram bot that you have created at @BotFather.
Send /help
command to ensure that everything is OK. You will get a complete list
of available bot commands. Use /add service_name
to add service_name.service
to
the monitoring system.
Now your monitoring bot is running smoothly! Personalize it by adding botpic and commands list (get command description by sending /help) at @BotFather, if you want.
Feel free to contact me at [email protected] at any time if you have questions!
As was written in the installation notice, the installation script installs and sets Python 3.8 as the default Python and Python3 interpreter in your system. It's likely that your failures were connected with this update.
You should remove virtual environment directory of your failed projects:
sudo rm -r venv
After that create venv again and install your project dependencies:
python3 -m venv venv
source venv/pin/activate
pip3 install <required_modules>
Don't forget to replace <required_modules>
with -r requirements.txt
or module names.