This article describes how to use python to monitor apache server processes in linux. for details, refer to crtrl. py to monitor the Python scripts of Apache server processes.
The code is as follows:
! /Usr/bin/env PythonImport OS, sys, time
While True:Time. sleep (4)Try:Ret = OS. popen ('PS-C apache-o pid, cmd'). readlines ()If len (ret) Print "The apach
There are many open-source network monitoring tools for Linux systems. For example, you can use command iftop to check bandwidth usage. Netstat is used to view the interface statistics report and the current running process of top monitoring system. But if you want to find a tool that can count network bandwidth utilization in real time, then Nethogs is worth a look.Nethogs is an open source command-line to
Sometimes our customers will find that the server or VPS network is slow, and further find that a lot of bandwidth is occupied, some customers so far do not know how to do. Is there a simple way to figure out which program (or process) is taking up the bandwidth? Linux monitors the flow of small tools, such as Iftop, Iptraf, Ifstat, Darkstat, Bwm-ng, Vnstat, and so on, mostly statistics and monitoring netwo
Use NetHogs to monitor the network usage of each process in Linux
(I) download
Nethogs-0.8.0.tar.gz
Before installation, you may need to install yum install ncurses *
(Ii) Role
Different from other statistics and monitoring of network card Traffic, NetHogs is a bit special and can monitor the network bandwidth usa
㈠ Download and installPreparation Environment: Yum-y Install Libpcap-devel ncurses-devel wget http://sourceforge.net/projects/nethogs/files/nethogs/0.8/nethogs-0.8.0.tar.gz/downloadtar xvzf nethogs-0.8.0.tar.gzCD NethogsMake make install㈡ Effectdifferent from other statistics and monitoring network card traffic, nethogs a bit special, can monitor each process of net bandwidth usage㈢ UseThe program requires
crtrl.py python script to monitor the Apache server process
Copy Code code as follows:
!/usr/bin/env Python
Import OS, sys, time
While True:Time.sleep (4)Tryret = Os.popen (' ps-c apache-o pid,cmd '). ReadLines ()If Len (ret) Print "Apache process quits unexpectedly, reboot after 4 seconds"Time.sleep (3)Os.system ("Service apache2
application.
You can also prevent your system files from being modified, which you don't yet know.
For example: Login back door, process hidden ...
You also need to be able to notify your phone in a timely manner. And you don't have to stare at the monitor all the time.
Use Description:
This system is used to monitor and manage your
In the company's FTP server, SERVU services are often automatically offline, each time need to manually go to a bit of trouble.Then write a script to set the scheduled task to check the status of the FTP service and restart the service.Ideas:Set a scheduled task: Use the FTP command to connect to the FTP upload file, and then detect if the file is uploaded successfully, if the upload successfully logs success information to the log file. If the upload
ServiceCheck process httpd with Pidfile/var/run/httpd.pidGroup ApacheStart program = "/ETC/INIT.D/HTTPD start"Stop program = "/ETC/INIT.D/HTTPD Stop"If failed host 127.0.0.1 Port 80Protocol HTTP then restartIf 5 restarts within 5 cycles then timeoutMonitoring HTTP ServicesMonitoring Custom ServicesCheck process web_lb with Pidfile/data/v20/server/web_lb/httpd.pidStart program = "/data/v20/bin/lb.sh"//Start
How to Use the supervisor to guard the main php-fpm process for Automatic Restart of php-fpm, supervisorphp-fpm
Recently, a colleague has a monitoring requirement for the php-fpm process, that is, if the master process of the php-fpm unexpectedly exits (may be crash or killed by mistake ), we hope that the master
Sharing the use of the Linux Restart command, how does Linux restart the network?The first part, about the use of the Linux restart command1, shutdown2, Poweroff3. Init4, reboot5, halt*---Specific instructions---ShutdownRebootSome
are? daemonize $php _opts, and the $php_opts value is "? Fpm-config $ php_fpm_conf pid $php _fpm_pid ".
Note : When php-fpm.sh starts the PHP-FPM master process, the Daemonize parameter is passed in, indicating that PHP-FPM master processes is started in Daemon (daemon) mode. According to the supervisor documentation, when using the Supervisor monitoring process, the guardianship
/php-fpm.sh start" When actually executing the code, you can see that the PHP-FPM process's startup parameters are –daemonize $php_opts, while $php_ The value of opts is "–fpm-config $php_fpm_conf–pid $php_fpm_pid".Note : When php-fpm.sh starts the PHP-FPM master process, the Daemonize parameter is passed in, indicating that PHP-FPM master processes is started in Daemon (daemon) mode. According to the supervisor documentation, when using the Superviso
for other servers, such as databases.But generally speaking, a CPU is good for a worker.So, the whole architecture is like this:The master process, what needs to be done is to monitor the worker's life cycle, if the worker is found to be dead, restart the worker, and do the corresponding log.The whole architecture does not have much difficulty, the focus is to d
Process Monitoring Scripts
1, determine the process name
After running the program you want to monitor, execute the following command:
Ps-ef
All of the processes in the system are listed, and the program's corresponding process name is found in the CMD column.
2. Process
Php-fpm process shutdown and restart script details, php-fpm details. Php-fpm process shutdown and restart script details, php-fpm details first to understand what is php-fpmPHP-FPM is a PHPFastCGI manager, is only used for PHP. PHP-FPM is actually PHP source code of the php-fpm pr
parameter in./configure. Use PHP-FPM to control FastCGI processes of PHP-CGI(Www.111cn.net)The master process can understand the following signals:
INT, TERM terminated immediatelyQUIT smooth terminationUSR1 re-open the log fileUSR2 smoothly reloads all worker processes and reloads configuration and binary modules.
Example:
Disable php-fpm:
The Code is as follows:Kill-INT 'cat/usr/local/php/var/run/php-fpm.pid'
Php-fpm
using cron to monitor background process statushttp://blog.csdn.net/dyx810601/article/details/729677581.Use cron to monitor the status of the background process and automatically pull the process out if the process dies or the ser
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.