【share系统源码】【忆奇达源码】【jwtutil配置类源码】进程监视源码_进程监视源码是什么
1.linuxä¸å¦ä½çå¬è¿ç¨
linuxä¸å¦ä½çå¬è¿ç¨
ä¸ãsupervise
Superviseæ¯daemontoolsçä¸ä¸ªå·¥å ·ï¼å¯ä»¥ç¨æ¥çæ§ç®¡çunixä¸çåºç¨ç¨åºè¿è¡æ åµï¼å¨åºç¨ç¨åºåºç°å¼å¸¸æ¶ï¼superviseå¯ä»¥éæ°å¯å¨æå®ç¨åºã
使ç¨ï¼
mkdir test
cd test
vim run åå ¥å¸ææ§è¡çæä½
supervise test (注æè¿éæ¯çåæ°æ¯runæ件ä¸å±çæ件夹ï¼æ¹årunç为å¯æ§è¡ chmod +x run)
äºãmonit
monitæ¯ä¸ä¸ªå°åçå¼æ¾æºç å·¥å ·æ¥ç®¡çåçæ§Unixç³»ç»ãMonitå¯ä»¥èªå¨ç»´æ¤è¿ç¨ï¼åæ¶é¿å è¿ç¨å¼å¸¸éåºç产ççé®é¢ã
ç³»ç»ï¼ monitå¯ä»¥çæ§é®é¢çåçï¼å æ¬è¿ç¨ç¶æãç³»ç»cpuè´è½½ãå åå ç¨æ åµçï¼ä¾å¦å½apacheæå¡çcpuè´è½½ä»¥åå åé¸å¼æ åµè¿é«æ¶åï¼å®ä¼éå¯apacheæå¡ã
è¿ç¨ï¼ monitå¯ä»¥çæ§å®æ¤è¿ç¨ï¼å æ¬ç³»ç»è¿ç¨ãä¾å¦å½æ个è¿è¡downæï¼å®ä¼èªå¨æ¢å¤éå¯è¯¥è¿ç¨ã
æ件系ç»ï¼Monitå¯ä»¥çæ§æ¬å°æ件ãç®å½ãæ件系ç»çååï¼å æ¬æ¶é´æ³ãæ ¡éªå¼ã大å°çååãä¾å¦ï¼å¯ä»¥çæ§æ件sha1以åmd5çå¼ï¼æ¥çæ§æ件æ¯å¦åçååã
ç½ç»ï¼monitå¯ä»¥çæ§ç½ç»è¿æ¥ï¼æ¯æTCPãUDPãUnix domain sockets以åHTTPãSMTPçã
å®æ¶èæ¬ï¼monitå¯ä»¥ç¨æ¥å®æ¶æµè¯ç¨åºåèæ¬ï¼è·åç¨åºè¾åºç»æï¼è¿èå¤ææ¯å¦æåæå ¶ä»æ åµã
å®è£ ï¼
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 mand=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