我正在努力为 php-fpm 找到一个有效的 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
Run Code Online (Sandbox Code Playgroud)
但它失败了,因为没有php-fpm.sock (Centos 6)
小智 5
我在 php-fpm 中使用 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;
}
Run Code Online (Sandbox Code Playgroud)
在 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
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5252 次 |
| 最近记录: |