解決策は、次の行を置き換えることでした。
check process apache with pidfile /var/run/httpd.pid
この行で:
check process httpd with pidfile /var/run/httpd/httpd.pid
また、「グループ apache」も削除しました。
元の投稿:
CentOS にMonitをインストールし、Apache (httpd) サービスのアラートを設定すると、サービスは /var/run/httpd.pid ファイルを作成しなくなります。
httpd サービスは正常に実行されています。
さらに、それだけでは不十分であるかのように、Monit はサービスのステータスを次のように報告します。
当然のことながら、このようなサービスを再起動する唯一の方法は、強制終了することです。これは、「再起動」スクリプトが実行中のプロセスを認識しないためです。
/etc/monit.d/monitrc ファイルの内容は次のとおりです。
set daemon 10
set logfile syslog facility log_daemon
set mailserver localhost
set mail-format { from: me@server.com }
set alert bugs@server.com
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
「service httpd restart」の出力:
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]
どんな助けでも大歓迎です。