D
D
DVoropaev2019-06-19 13:12:01
linux
DVoropaev, 2019-06-19 13:12:01

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

7 answer(s)
D
Denis Fomin, 2019-06-19
@TaPO4eg3D

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.

T
TyzhSysAdmin, 2019-06-19
@POS_troi

You can write a script, you can use any monitoring system and still write a script :)

C
CityCat4, 2019-06-19
@CityCat4

nagios + nrpe (or nsclient++ for Windows)

V
Vladimir, 2019-06-19
@mole2

I use the monitoring system monit
is easily configured.
doc here
https://mmonit.com/monit/documentation/monit.html

M
maledog, 2019-06-19
@maledog

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.

R
Ruslan Fedoseev, 2019-06-19
@martin74ua

zabbix and other monitors. Thousands of them.

D
Dmitry, 2019-06-20
@hempy80

Monit - will raise the fallen one, restart the hung one, send alerts.
In addition to monitoring services, it can monitor a bunch of other events. Well documented.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question