Answer the question
In order to leave comments, you need to log in
How to send an e-mail message about fallen services?
I want to receive a message in my mail if some service has fallen. Are there ready-made solutions? If you write a script, then which module should you use?
Answer the question
In order to leave comments, you need to log in
I would use a bunch of python and cron for this.
I've never done this, but I'll try to imagine. The systemd service has a wonderful function - to display all services that have fallen, it looks like this:
Next, in Python, we have a wonderful module for executing subprocess commands.
Well, with the help of it we execute the command and parse the result, if we have fallen services, then we send a letter. You can use the built-in smtplib to send an email.
Next, we set up cron so that it executes this script, say, every 30 seconds. That's it, the script is ready.
You can write a script, you can use any monitoring system and still write a script :)
I use the monitoring system monit
is easily configured.
doc here
https://mmonit.com/monit/documentation/monit.html
ROLF. Maybe for a start to decide what kind of service? In order to understand the criteria by which to determine that the service has fallen? Services are different. Somewhere it is enough to search for a process by name, somewhere to check for an open port, somewhere more complex rules are needed. There is no one magic solution that monitors any service, or it is such a colossus that it needs separate monitoring.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question