我很难为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但是它失败了,因为没有php-fpm.sock (Centos 6)
发布于 2011-10-26 22:53:10
我正在使用php中的ping.path指令来检查它是否有效.
并在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;
}发布于 2012-06-19 10:47:35
对于其他在Centos 6上有此问题的人,php-fpm套接字位于/var/run/php-fpm/php-fpm.sock中。
因此,最终配置如下所示:
check process php-fpm with pidfile /var/run/php-fpm/php-fpm.pid
group phpcgi #change accordingly
start program = "/etc/init.d/php-fpm start"
stop program = "/etc/init.d/php-fpm stop"
if failed unixsocket /var/run/php-fpm/php-fpm.sock then restart
if 3 restarts within 5 cycles then timeout发布于 2012-06-18 08:23:43
而不是:
if failed unixsocket /var/run/php-fpm.sock then restart你可以尝试:
if failed port 9000 type TCP then restart它不需要像location /ping那样编辑lighttpd/nginx。
我在Ubuntu上的/etc/monit/conf.d/php-fpm.conf如下所示:
check process php-fpm with pidfile /var/run/php5-fpm.pid
stop program = "/sbin/start-stop-daemon --stop --pidfile /var/run/php5-fpm.pid"
start program = "/sbin/start-stop-daemon --start --pidfile /var/run/php5-fpm.pid --exec /usr/sbin/php5-fpm"
if failed port 9000 type TCP then restarthttps://stackoverflow.com/questions/7846847
复制相似问题