Решением было заменить эту строку:
check process apache with pidfile /var/run/httpd.pid
На эту строку:
check process httpd with pidfile /var/run/httpd/httpd.pid
И я также удалил 'group apache'.
Оригиналpost:
После установки Monit в CentOS и установки оповещения для службы Apache (httpd) служба больше не создает файл /var/run/httpd.pid.
Служба httpd IS работает правильно.
Вдобавок к этому, как будто этого недостаточно, Monit сообщает о состоянии службы как: Ошибка выполнения
Естественно, единственный способ перезапустить такую службу - это убить ее, поскольку сценарий «перезапуска» не видит запущенный процесс.
Это содержимое /etc/monit.d/monitrc.file:
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]
Любая помощь будет принята с благодарностью.