首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >php-fpm的monit配置

php-fpm的monit配置
EN

Server Fault用户
提问于 2011-10-19 08:29:23
回答 4查看 5.6K关注 0票数 1

我很难为php找到一个有效的monit配置。

这就是我尝试过的:

代码语言:javascript
运行
复制
### 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)

EN

回答 4

Server Fault用户

回答已采纳

发布于 2011-11-10 19:55:23

我正在使用php中的ping.path指令来检查它是否工作.

并在nginx.conf上配置它(我不知道它是否是S的设置)

代码语言:javascript
运行
复制
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;
}

关于监测

代码语言:javascript
运行
复制
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
票数 6
EN

Server Fault用户

发布于 2012-06-12 16:08:37

据我所见,php5-fpm与其他进程(如nginx)之间唯一的区别是它的pid文件不包含换行符。也许这就是问题所在。在任何情况下,我的解决方案都是丑陋的,但它也很好:我只是直接检查"process /var/run/php5-fpm.sock“(同时试图找到对此bug的修复)。

票数 1
EN

Server Fault用户

发布于 2011-10-24 03:21:05

您考虑过使用monit的进程模式匹配以及现有的守护进程启动和停止吗?

某种形式的matching "php-fpm"

票数 0
EN
页面原文内容由Server Fault提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://serverfault.com/questions/322825

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档