Data source: Linux Process monitoring
Supervise
Supervise is a daemontools tool that can be used to monitor the operation of applications running under UNIX, and supervise can restart the specified program when an application exception occurs.
Use:
mkdir Testcd Testvim Run writes the action you want to perform supervise test (note here is the folder on the upper level of the run file, changing the run to executable chmod +x run)
Monit
Monit is a small open source tool to manage and monitor UNIX systems. Monit can automatically maintain the process, to avoid the process of abnormal exit and other problems arising.
System: Monit can monitor the problem, including process status, System CPU load, memory consumption, etc., such as when the Apache service CPU load and memory lock is too high, it will restart the Apache service.
Process: Monit can monitor daemon processes, including system processes. For example, when one is down, it automatically resumes restarting the process.
File system:Monit can monitor changes in local files, directories, and file systems, including timestamps, checksum values, and size changes. For example, you can monitor file SHA1 and MD5 values to monitor whether a file has changed.
Network:Monit can monitor network connections, support TCP, UDP, Unix domain sockets, and HTTP, SMTP, and so on.
Installation:
sudo apt-get install Monit
To edit a configuration:
sudo vim/etc/monit/monitrc
Start, stop, restart:
Sudo/etc/init.d/monit Startsudo/etc/init.d/monit stopsudo/etc/init.d/monit Restart
To set the page monitoring status:
Set httpd port 2812 andallow 0.0.0.0/0.0.0.0allow localhost
Increased monitoring:
Note that there is a need to add start and stop, missing one is not possible
1. Monitoring according to the program name
Check process test with MATCHING test.pystart program = "/home/yxd/test.py" Stop program = "xxxxx"
2. According to PID monitoring
Check process Apache with Pidfile/var/run/httpd.pidstart program = "/etc/init.d/rcwebserver.sh start https" Stop program = "/etc/init.d/rcwebserver.sh Stop https" if changed PID then Aler
Reference: Monitoring system critical processes with Monit
Supervisord
Supervisor is a C/s system that allows users to monitor and control the number of background service processes in a UNIX-like operating system. It is written by Python and is often used for restart protection of process exception exits.
Installation:
Pip Install Supervisor
To view the configuration file:
Echo_supervisord_conf
From the results of this command, you can see the configuration information for each module.
To create a configuration file:
echo_supervisord_conf >/etc/supervisord.conf
To configure the app:
[program:test]command=python/root/test_supervisor.pyprocess_name=% (Program_name) sstdout_logfile=/root/ Test.logstderr_logfile=/root/test.log
Save, start:
/usr/bin/supervisord-c/etc/supervisord.conf
Linux process Monitoring