我很难为php找到一个有效的monit配置。
这就是我尝试过的:
### 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)
发布于 2011-11-10 11:55:23
我正在使用php中的ping.path指令来检查它是否工作.
并在nginx.conf上配置它(我不知道它是否是S的设置)
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
发布于 2012-06-12 08:08:37
据我所见,php5-fpm与其他进程(如nginx)之间唯一的区别是它的pid文件不包含换行符。也许这就是问题所在。在任何情况下,我的解决方案都是丑陋的,但它也很好:我只是直接检查"process /var/run/php5-fpm.sock“(同时试图找到对此bug的修复)。
发布于 2011-10-23 19:21:05
您考虑过使用monit的进程模式匹配以及现有的守护进程启动和停止吗?
某种形式的matching "php-fpm"
https://serverfault.com/questions/322825
复制相似问题