1. 启用php-fpm状态功能

# cat  /usr/local/php/etc/php-fpm.conf | grep status_path
pm.status_path = /status

2. nginx配置

location ~ ^/(status|ping)$
{
include fastcgi_params;
fastcgi_pass 127.0.0.1:;
fastcgi_param SCRIPT_FILENAME $fastcgi_script_name;
}

3. 重启nginx/php-fpm

# service nginx restart
# service php-fpm restart

4. 打开status页面

# curl http://127.0.0.1/status
pool: www
process manager: dynamic
start time: /Feb/::: +
start since:
accepted conn:
listen queue:
max listen queue:
listen queue len:
idle processes:
active processes:
total processes:
max active processes:
max children reached:
slow requests:

5. php-fpm status详解

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,缓慢请求的数量

6. php-fpm其他参数

php-fpm状态页比较个性化的一个地方是它可以带参数,可以带参数json、xml、html并且前面三个参数可以分别和full做一个组合。

6.1 json

# curl http://127.0.0.1/status?json
{"pool":"www","process manager":"dynamic","start time":,"start since":,"accepted conn":,"listen queue":,"max listen queue":,"listen queue len":,"idle processes":,"active processes":,"total processes":,"max active processes":,"max children reached":,"slow requests":}

6.2 xml

# curl http://127.0.0.1/status?xml
<?xml version="1.0" ?>
<status>
<pool>www</pool>
<process-manager>dynamic</process-manager>
<start-time></start-time>
<start-since></start-since>
<accepted-conn></accepted-conn>
<listen-queue></listen-queue>
<max-listen-queue></max-listen-queue>
<listen-queue-len></listen-queue-len>
<idle-processes></idle-processes>
<active-processes></active-processes>
<total-processes></total-processes>
<max-active-processes></max-active-processes>
<max-children-reached></max-children-reached>
<slow-requests></slow-requests>

6.3 html

# curl http://127.0.0.1/status?html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head><title>PHP-FPM Status Page</title></head>
<body>
<table>
<tr><th>pool</th><td>www</td></tr>
<tr><th>process manager</th><td>dynamic</td></tr>
<tr><th>start time</th><td>/Feb/::: +</td></tr>
<tr><th>start since</th><td></td></tr>
<tr><th>accepted conn</th><td></td></tr>
<tr><th>listen queue</th><td></td></tr>
<tr><th>max listen queue</th><td></td></tr>
<tr><th>listen queue len</th><td></td></tr>
<tr><th>idle processes</th><td></td></tr>
<tr><th>active processes</th><td></td></tr>
<tr><th>total processes</th><td></td></tr>
<tr><th>max active processes</th><td></td></tr>
<tr><th>max children reached</th><td></td></tr>
<tr><th>slow requests</th><td></td></tr>
</table>
</body></html>

6.4 full

# curl http://127.0.0.1/status?full
pool: www
process manager: dynamic
start time: /Feb/::: +
start since:
accepted conn:
listen queue:
max listen queue:
listen queue len:
idle processes:
active processes:
total processes:
max active processes:
max children reached:
slow requests: ************************
pid:
state: Idle
start time: /Feb/::: +
start since:
requests:
request duration:
request method: GET
request URI: /sesamestreet/elmo/index.php
content length:
user: -
script: /www//sesamestreet/elmo/index.php
last request cpu: 38.14
last request memory: ************************
pid:
state: Idle
start time: /Feb/::: +
start since:
requests:
request duration:
request method: GET
request URI: /index.php
content length:
user: -
script: /www//index.php
last request cpu: 0.00
last request memory: ************************
pid:
state: Idle
start time: /Feb/::: +
start since:
requests:
request duration:
request method: GET
request URI: /status?xml
content length:
user: -
script: /status
last request cpu: 0.00
last request memory: ************************
pid:
state: Idle
start time: /Feb/::: +
start since:
requests:
request duration:
request method: GET
request URI: /index.php
content length:
user: -
script: /www//index.php
last request cpu: 0.00
last request memory: ************************
pid:
state: Idle
start time: /Feb/::: +
start since:
requests:
request duration:
request method: GET
request URI: /sesamestreet/elmo/index.php
content length:
user: -
script: /www//sesamestreet/elmo/index.php
last request cpu: 64.27
last request memory: ************************
pid:
state: Running
start time: /Feb/::: +
start since:
requests:
request duration:
request method: GET
request URI: /status?full
content length:
user: -
script: /status
last request cpu: 0.00
last request memory:

6.5 full详解

pid – 进程PID,可以单独kill这个进程. You can use this PID to kill a long running process.
state – 当前进程的状态 (Idle, Running, …)
start time – 进程启动的日期
start since – 当前进程运行时长
requests – 当前进程处理了多少个请求
request duration – 请求时长(微妙)
request method – 请求方法 (GET, POST, …)
request URI – 请求URI
content length – 请求内容长度 (仅用于 POST)
user – 用户 (PHP_AUTH_USER) (or ‘-’ 如果没设置)
script – PHP脚本 (or ‘-’ if not set)
last request cpu – 最后一个请求CPU使用率。
last request memorythe - 上一个请求使用的内存

zabbix客户端配置

增加自定义key

# cat zabbix_agentd.conf | grep 'php-fpm'
#php-fpm
UserParameter=php-fpm.status[*],/usr/bin/curl -s "http://127.0.0.1/status?xml" | grep "<$1>" | awk -F'>|<' '{ print $$3}'

重启zabbix客户端

/etc/init.d/zabbix_agentd restart

zabbix管理后台配置

导入php-fpm模板

进入后台->configuration->templates->import(右侧)->选择php模板->最后点击import。至此php-fpm模板已经导入到zabbix中

 

zabbix监控php-fpm性能状态的更多相关文章

  1. zabbix 监控web网站性能

    一直在纠结用什么实例来给大家演示呢?想来想去还是官方的好,那我们怎么用zabbix监控web性能和可用性呢?我们这边分为几个步骤:打开网站.登陆.登陆验证.退出,一共4个小step,看实例. 检测流程 ...

  2. Zabbix监控web,MySQL,TCP状态,Nginx

    接上篇Zabbix使用SMTP发送邮件报警并且制定报警内容 Zabbix怎么设置声音告警 web监控 在zabbix server选择web 创建一个监控web的场景 添加后这里有数字1 查看 假如在 ...

  3. zabbix监控WEB网站性能

    一直在纠结用什么实例来给大家演示呢?想来想去还是官方的好,那我们怎么用zabbix监控web性能和可用性呢?我们这边分为几个步骤:打开网站.登陆.登陆验证.退出,一共4个小step,看实例. 检测流程 ...

  4. zabbix监控php-fpm的性能

    zabbix监控php-fpm主要是通过nginx配置php-fpm的状态输出页面,在正则取值 要nginx能输出php-fpm的状态必须要先修改php-fpm的配置,这个配置没有开启nginx 就没 ...

  5. zabbix监控nginx的性能

    1.nginx配置 需要使用zabbix监控nginx,首先nginx需要配置ngx_status,在nginx的配置文件中加入红框中的配置,然后重启nginx如下图所示: location /ngx ...

  6. (41)zabbix监控api接口性能及可用性 天气预报api为例

    现在各种应用都走api,例如淘宝,天气预报等手机.pad客户端都是走api的,那么平时也得对这些api做监控了.怎么做呢?zabbix的web监控是不二选择了.今天就以天气预报api作为一个例子. 天 ...

  7. zabbix监控rabbitmq队列消费状态

    使用rabbitmqctl 管理 mq -n 指定节点 [root@logging-master zabbix]# rabbitmqctl -n rabbit@localhost list_queue ...

  8. zabbix 监控 WEB 应用性能

    1.介绍使用 zabbix_sender 发送采集的 WEB 状态值,使用 pycurl 来采集 WEB 状态zabbix_sender发送数据,需保证主机名与zabbix server记录的主机名一 ...

  9. zabbix监控nginx+php-fpm,mysql+主从复制+高可用,tomcat,redis web状态

    zabbix监控对象区分 使用SNMP监控交换 使用IPMI监控服务器硬件 使用Agent监控服务器 使用JMX监控JAVA SNMP监控流程 交换机上开启snmp 在zabbix上添加监控(设置SN ...

  10. 跟着ttlsa一起学zabbix监控呗

    本章转载至:http://www.ttlsa.com/zabbix/follow-ttlsa-to-study-zabbix/ 虽然接触zabbix时间很长,但是中间相当一段时间没去配置,这次算是重新 ...

随机推荐

  1. AospExtended K3 Note最新官方版 Android7.1.2 极速 省电 流畅 Galaxy XIAOMI Moto Lenovo Coolpad 均支持

    AospExtended 最新官方版 Android7.1.2 极速 省电 流畅 Galaxy  XIAOMI Moto  Lenovo  Coolpad  均支持 之前用过1629开发版等,体验了很 ...

  2. [leetcode-500-Keyboard Row]

    Given a List of words, return the words that can be typed using letters of alphabet on only one row' ...

  3. JavaScript深入浅出补充——(二)语句和严格模式,对象

    三.语句和严格模式 JavaScript程序由语句组成,语句遵守语法规则. 例如:if语句,while语句,with语句等等-- block块语句 常用于组合0~多个语句,块语句用{}定义 直接以花括 ...

  4. ionic ios项目真机运行-不用开发者账号

    ionic ios项目真机运行-不用开发者账号 1. 添加ios平台 ionic platform add ios 2.使用XCODE打开项目 3.使用APPID登录XCODE 打开XCODE账号登录 ...

  5. .net入门 - Get Started with .NET

    阅读原文 有很多种方式去开始使用.net.因为.net是一个巨大的平台,在这个文档里面有很多文章,告诉你如何从不同的角度去开始使用.net. 使用.NET的语言入门 C#入门文章和C#教程提供了以C# ...

  6. wget下载站点文件

    非常简单的指令,只需要: wget -c -r -p -k -np [URL] 下面解释下个参数的意义: -c 断点续传 -r 递归下载,可遍历整个站点的结构 -p 网页显示所需要的素材(图片\css ...

  7. FileEditor

    package JBJADV003; import java.io.*; class FileEditor { public static void main(String args[]) throw ...

  8. centos+apache 2.x 开启gzip压缩

    最近做了一个网站(PHP+Apache+MySQL),挂在百度云平台上面,基本配置是2G内存+5Mb带宽,每次打开主页都需要2-3s左右的时间,对于一个垂直搜索引擎来说,用户体验肯定会很差. 于是开始 ...

  9. Java数据类型在实际开发中的应用一

    在前边的博文中,我已经介绍了Java核心的容器IO等,现在我来说一下java中的数据类型.在java中,一切东西皆为对象(这句话意思是java中绝大数情况都用对象),极少数不是对象的,也存在与之对应的 ...

  10. WPF制作带明细的环形图标

    效果 明细用Popup实现的,录gif时,Popup显示不出来,不知道为什么,所以静态图凑合看吧 大体思路 图表使用Arc+Popup实现 图表分为两部分,一是环形部分,一是标注的明细部分. 环形部分 ...