monit configuration para php-fpm

1

Estou com dificuldades para encontrar uma configuração de monit para o php-fpm que funcione.

Isso é o que eu tentei:

### 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

Mas falha porque não há php-fpm.sock (Centos 6)

    
por Adam Jimenez 19.10.2011 / 10:29

4 respostas

5

Estou usando a diretiva ping.path em php-fpm para verificar se está funcionando ...

e configurou no nginx.conf (eu não sei se é a sua configuração)

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;
}

Em monit.d

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
    
por 10.11.2011 / 20:55
1

Até onde pude ver, a única diferença entre o php5-fpm e outros processos (como o nginx) é que seu arquivo pid não contém um caractere de nova linha. Talvez seja esse o problema. Em qualquer caso, minha solução é mais feia, mas também funciona bem: eu apenas checo "process php-fpm com pidfile /var/run/php5-fpm.sock" diretamente (enquanto tento encontrar uma correção para esse bug).

    
por 12.06.2012 / 18:08
0

Você já considerou o uso da correspondência de padrões de processo do monit junto com o daemon existente iniciar e parar?

Alguma forma de matching "php-fpm"

    
por 24.10.2011 / 05:21
0

Existe um arquivo php-fpm.sock em /var/run/php-fpm/php-fpm.sock ? Se houver, modifique esta linha

if failed unixsocket /var/run/php-fpm.sock then restart

wit

if failed unixsocket /var/run/php-fpm/php-fpm.sock then restart
    
por 24.10.2011 / 08:54

Tags