Я изо всех сил пытаюсь найти конфигурацию monit для php-fpm, которая работает.
Вот что я пробовал:
### Monitoring php-fpm: the parent process.
check process php-fpm with pidfile /var/run/php-fpm/php-fpm.pid
group phpcgi # phpcgi group
start program = "/etc/init.d/php-fpm start"
stop program = "/etc/init.d/php-fpm stop"
## Test the UNIX socket. Restart if down.
if failed unixsocket /var/run/php-fpm.sock then restart
## If the restarts attempts fail then alert.
if 3 restarts within 5 cycles then timeout
depends on php-fpm_bin
depends on php-fpm_init
## Test the php-fpm binary.
check file php-fpm_bin with path /usr/sbin/php-fpm
group phpcgi
if failed checksum then unmonitor
if failed permission 755 then unmonitor
if failed uid root then unmonitor
if failed gid root then unmonitor
## Test the init scripts.
check file php-fpm_init with path /etc/init.d/php-fpm
group phpcgi
if failed checksum then unmonitor
if failed permission 755 then unmonitor
if failed uid root then unmonitor
if failed gid root then unmonitor
Но это не удается, потому что нет php-fpm.sock (Centos 6)
Я использую директиву ping.path в php-fpm, чтобы проверить, работает ли она ...
и настроил его на nginx.conf (я не знаю, ваша установка)
location /ping {
access_log off;
allow 127.0.0.1;
deny all;
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /usr/share/nginx/html$fastcgi_script_name;
include fastcgi_params;
}
На пн.д
check process php-fpm.www with pidfile /var/run/php-fpm/php-fpm.pid
group php-fpm
start program = "/etc/init.d/php-fpm start"
stop program = "/etc/init.d/php-fpm stop"
if failed host localhost port 80 protocol http
and request '/ping'
with timeout 20 seconds for 5 cycles
then restart
## If the restarts attempts fail then alert.
if 3 restarts within 5 cycles then timeout
depends on php-fpm_bin
depends on php-fpm_init
depends on nginx
Насколько я мог видеть, единственная разница между php5-fpm и другими процессами (например, nginx) заключается в том, что его файл pid не содержит символа новой строки. Может в этом проблема. В любом случае, мое решение уродливее, но оно также отлично работает: я просто проверяю «обработать php-fpm с помощью pidfile /var/run/php5-fpm.sock» напрямую (пытаясь найти исправление этой ошибки).
Рассматривали ли вы возможность использования сопоставления шаблонов процессов monit с существующим запуском и остановкой демона?
Некоторая форма matching "php-fpm"
Здесь php-fpm.sock
файл в /var/run/php-fpm/php-fpm.sock
? Если есть, измените эту строку
if failed unixsocket /var/run/php-fpm.sock then restart
остроумие
if failed unixsocket /var/run/php-fpm/php-fpm.sock then restart