nginx、php-fpm运行状态监控
前言
fpm直接修改配置就可以了,nginx需要--with-http_stub_status_module 模块
php.ini配置
pm.status_path = /status_fpm
访问配置
server {
    listen       80;
    server_name  fpm.loc;
    location ~ ^/(status_fpm|ping)$  {
        # 只允许指定ip访问
        # allow 172.30.1.108;
        # deny all;
        access_log off;
        fastcgi_pass   php74:9000;
        include        fastcgi-php.conf;
        fastcgi_param PATH_INFO $fastcgi_path_info;
        include        fastcgi_params;
    }
    location /status_nginx {
        # 只允许指定ip访问
        # allow 172.30.1.108;
        # deny all;
        access_log off;
        stub_status;
    }
}访问如下地址即可
http://fpm.loc/status_fpm?json

http://fpm.loc/status_nginx

fpm状态
pool – fpm池子名称,大多数为www
process manager – 进程管理方式,值:static, dynamic or ondemand. dynamic
start time – 启动日期,如果reload了php-fpm,时间会更新
start since – 运行时长
accepted conn – 当前池子接受的请求数
listen queue – 请求等待队列,如果这个值不为0,那么要增加FPM的进程数量
max listen queue – 请求等待队列最高的数量
listen queue len – socket等待队列长度
idle processes – 空闲进程数量
active processes – 活跃进程数量
total processes – 总进程数量
max active processes – 最大的活跃进程数量(FPM启动开始算)
max children reached - 大道进程最大数量限制的次数,如果这个数量不为0,那说明你的最大进程数量太小了,请改大一点。
slow requests – 启用了php-fpm slow-log,缓慢请求的数量
nginx状态
active connections – 活跃的连接数量
server accepts handled requests — 总共处理了11989个连接 , 成功创建11989次握手, 总共处理了11991个请求
reading — 读取客户端的连接数.
writing — 响应数据到客户端的数量
waiting — 开启 keep-alive 的情况下,这个值等于 active – (reading+writing), 意思就是 Nginx 已经处理完正在等候下一次请求指令的驻留连接.