Linux process Monitoring

Source: Internet
Author: User

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.

    • Timed scripts:Monit can be used to test programs and scripts on a timed basis, obtaining output from the program to determine success or otherwise.

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.