的解決方案是替代這一行:monit的在CentOS使未httpd.pid要創建
check process apache with pidfile /var/run/httpd.pid
利用該行:
check process httpd with pidfile /var/run/httpd/httpd.pid
我也除去「組阿帕奇」。
原帖:
在CentOS爲Apache(httpd的)服務安裝Monit,並設置警報後,該服務不再創建/var/run/httpd.pid文件。
httpd服務IS正常運行。
在它的上面,彷彿這還不夠,monit的報告作爲服務的狀態:執行失敗
當然,重新啓動這樣的服務的唯一途徑是通過殺死它,因爲「重啓」腳本沒有看到任何正在運行的進程。
這些都是/etc/monit.d/monitrc文件的內容:
set daemon 10
set logfile syslog facility log_daemon
set mailserver localhost
set mail-format { from: [email protected] }
set alert [email protected]
set httpd port 2812 and
# SSL ENABLE
# PEMFILE /var/certs/monit.pem
allow user:password
check process apache with pidfile /var/run/httpd.pid
group apache
start program = "/etc/init.d/httpd start"
stop program = "/etc/init.d/httpd stop"
if cpu is greater than 180% for 1 cycles then alert
if totalmem > 1200 MB for 2 cycles then restart
if children > 250 then restart
check process sshd with pidfile /var/run/sshd.pid
start program "/etc/init.d/sshd start"
stop program "/etc/init.d/sshd stop"
if failed port 22 protocol ssh for 5 cycles then restart
if 5 restarts within 25 cycles then timeout
「服務的httpd重新啓動」 的輸出:
Stopping httpd: [FAILED]
Starting httpd: (98)Address already in use: make_sock: could not bind to address 0.0.0.0:80
no listening sockets available, shutting down
Unable to open logs
[FAILED]
任何幫助將不勝感激。
難道你不是指「monit restart httpd」嗎?那麼「monit stop httpd」和「monit start httpd」呢? 是否monit停止/啓動/重新啓動sshd好嗎? – 2011-04-28 14:47:02
謝謝abunetta。 當重新啓動時,停止,從Monit開始到httpd,沒有消息。但服務也沒有停止。 我不能試圖阻止sshd的,因爲它會離開我,在我的機器:-) – bizna 2011-04-29 13:38:31
嘗試使用發現這裏的建議是:要http://stackoverflow.com/questions/3356476/debugging-monit/4439403#4439403當monit呼叫停止時,更好地瞭解發生了什麼。當我從命令行調用它時,我假設monitrc中的停止命令有效。關於「monit restart sshd」;我仍然建議嘗試它作爲一個完整性檢查。您將設法以某種方式回到機器中,如果它不起作用:-) – 2011-04-30 19:15:17