标签:cWeb style blog http ar color os sp strong
sudo apt-get install monit
sudo vim /etc/monit/monitrc
sudo /etc/init.d/monit start sudo /etc/init.d/monit stop sudo /etc/init.d/monit restart
set httpd port 2812 and allow 0.0.0.0/0.0.0.0 allow localhost
需要注意的是,这里需要添加start和stop,缺一个都是不行的
1.根据程序名称来监控
check process test with MATCHING test.py start program = "/home/yxd/test.py" stop program = "xxxxx"
2.根据pid监控
check process apache with pidfile /var/run/httpd.pid start program = "/etc/init.d/rcWebServer.sh start https" stop program = "/etc/init.d/rcWebServer.sh stop https" if changed pid then aler
pip install supervisor
echo_supervisord_conf
echo_supervisord_conf > /etc/supervisord.conf
[program:test] command=python /root/test_supervisor.py process_name=%(program_name)s stdout_logfile=/root/test.log stderr_logfile=/root/test.log
/usr/bin/supervisord -c /etc/supervisord.conf
标签:cWeb style blog http ar color os sp strong
原文地址:http://www.cnblogs.com/coder2012/p/4130701.html