zabbix3监控php-fpm的状态
php-fpm和nginx一样内建了一个状态页,对于想了解php-fpm的状态以及监控php-fpm非常有帮助 . 启用php-fpm状态功能 [root@node1:~]# vim /usr/local/php-7.0.12_fpm/etc/php-fpm.conf
pm.status_path = /status
[root@node1:~]# cat /usr/local/php-7.0.12_fpm/etc/php-fpm.conf |grep status_path
pm.status_path = /status 默认情况下为/status,当然也可以改成其他的,例如/chinasoft_status等等。 . nginx配置 在默认主机里面加上location或者你希望能访问到的主机里面。 # 使用socket的方式进行通讯(推荐)
server {
listen default_server;
server_name 10.11.0.210;
location ~ ^/(status|ping)$ {
include fastcgi_params;
fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_param SCRIPT_FILENAME $fastcgi_script_name;
}
} 对应php-fpm.conf配置
listen = /tmp/php-cgi.sock # 使用fastcgi的方式进行通讯
server {
listen default_server;
server_name 10.11.0.210;
location ~ ^/(status|ping)$
{
include fastcgi_params;
fastcgi_pass 127.0.0.1:;
fastcgi_param SCRIPT_FILENAME $fastcgi_script_name; }
}
对应php-fpm.conf配置
listen = 127.0.0.1: . 重启nginx/php-fpm
请依照你的环境重启你的nginx和php-fpm
# service nginx restart
# service php-fpm restart 启动php-7.0.12_fpm报错
[root@node1:/usr/local/tengine-2.2./conf]# /etc/init.d/php-fpm restart
Gracefully shutting down php-fpm /etc/init.d/php-fpm: line : kill: () - No such process
................................... failed. Use force-quit
Starting php-fpm /usr/local/php/sbin/php-fpm: error while loading shared libraries: libpng12.so.: cannot open shared object file: No such file or directory
failed
解决办法:
[root@node1:/usr/local/tengine-2.2./conf]# yum install -y libpng . 打开status页面 [root@node1:/usr/local/php/etc]# curl http://10.11.0.210/status
pool: www
process manager: dynamic
start time: /Jun/::: +
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: . 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,缓慢请求的数量 . php-fpm其他参数 php-fpm状态页比较个性化的一个地方是它可以带参数,可以带参数json、xml、html并且前面三个参数可以分别和full做一个组合。 json
[root@node1:/usr/local/php/etc]# curl http://10.11.0.210/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":} xml
# curl http://127.0.0.1/status?xml html
# curl http://127.0.0.1/status?html full
# curl http://127.0.0.1/status?full
pool: www
process manager: dynamic
start time: /Jun/::: +
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: /Jun/::: +
start since:
requests:
request duration:
request method: GET
request URI: /status
content length:
user: -
script: -
last request cpu: 0.00
last request memory: ************************
pid:
state: Idle
start time: /Jun/::: +
start since:
requests:
request duration:
request method: GET
request URI: /status
content length:
user: -
script: -
last request cpu: 0.00
last request memory: ************************
pid:
state: Idle
start time: /Jun/::: +
start since:
requests:
request duration:
request method: GET
request URI: /status
content length:
user: -
script: -
last request cpu: 0.00
last request memory: ************************
pid:
state: Idle
start time: /Jun/::: +
start since:
requests:
request duration:
request method: GET
request URI: /status
content length:
user: -
script: -
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 - 上一个请求使用的内存 二、服务端的操作
导入php-fpm的监控模板
template php-fpm .添加监控脚本 vim /usr/local/zabbix_agents_3.2.0/scripts/php-fpm_status.sh #!/bin/bash listenqueue(){
curl -m -s http://127.0.0.1:80/status?auto |grep "listen queue:"|grep -vE "len|max"|awk '{print$3}'
} listenqueuelen(){
curl -m -s http://127.0.0.1:80/status?auto |grep "listen queue len" |awk '{print$4}'
} idle(){
curl -m -s http://127.0.0.1:80/status?auto |grep "idle processes" |awk '{print$3}'
}
active(){
curl -m -s http://127.0.0.1:80/status?auto |grep "active" |awk '{print$3}'|grep -v "process"
}
total(){
curl -m -s http://127.0.0.1:80/status?auto |grep "total processes" |awk '{print$3}'
} mactive(){ curl -m -s http://127.0.0.1:80/status?auto |grep "max active processes:" |awk '{print$4}'
} since(){
curl -m -s http://127.0.0.1:80/status?auto |grep "start since: " |awk '{print$3}'
} conn(){
curl -m -s http://127.0.0.1:80/status?auto |grep "accepted conn" |awk '{print$3}'
} reached(){
curl -m -s http://127.0.0.1:80/status?auto |grep "max children reached" |awk '{print$4}'
}
requests(){
curl -m -s http://127.0.0.1:80/status?auto |grep "slow requests" |awk '{print$3}'
}
http_code(){
curl -s --connect-timeout 8 -m 4 -o /dev/null -w %{http_code} "http://127.0.0.1/status"
}
up(){
ps -ef|grep "php-fpm: master process"|grep -v grep|wc -l
}
$ # 给脚本添加执行权限
chmod +x /usr/local/zabbix_agents_3.2.0/scripts/php-fpm_status.sh .增加配置文件
[root@node1:/usr/local/php/etc]# vim /usr/local/zabbix_agents_3.2.0/conf/zabbix_agentd/php-fpm_status.conf UserParameter=idle.processe,/usr/local/zabbix_agents_3.2.0/scripts/php-fpm_status.sh idle
UserParameter=total.processes,/usr/local/zabbix_agents_3.2.0/scripts/php-fpm_status.sh total
UserParameter=active.processes,/usr/local/zabbix_agents_3.2.0/scripts/php-fpm_status.sh active
UserParameter=max.active.processes,/usr/local/zabbix_agents_3.2.0/scripts/php-fpm_status.sh mactive
UserParameter=listen.queue.len,/usr/local/zabbix_agents_3.2.0/scripts/php-fpm_status.sh listenqueuelen
UserParameter=listen.queue,/usr/local/zabbix_agents_3.2.0/scripts/php-fpm_status.sh listenqueue
UserParameter=start.since,/usr/local/zabbix_agents_3.2.0/scripts/php-fpm_status.sh since
UserParameter=accepted.conn,/usr/local/zabbix_agents_3.2.0/scripts/php-fpm_status.sh conn
UserParameter=max.children.reached,/usr/local/zabbix_agents_3.2.0/scripts/php-fpm_status.sh reached
UserParameter=slow.requests,/usr/local/zabbix_agents_3.2.0/scripts/php-fpm_status.sh requests
UserParameter=up,/usr/local/zabbix_agents_3.2.0/scripts/php-fpm_status.sh up
UserParameter=http_code,/usr/local/zabbix_agents_3.2.0/scripts/php-fpm_status.sh http_code
.重启客户端,并测试 [root@node1:~]# /usr/local/zabbix_agents_3.2.0/scripts/php-fpm_status.sh idle [root@node1:~]# /usr/local/zabbix_agents_3.2.0/scripts/php-fpm_status.sh total # 服务端测试 [root@node5 ~]# zabbix_get -s 10.11.0.210 -p -k "active.processes" [root@node5 ~]# zabbix_get -s 10.11.0.210 -p -k "slow.requests" [root@node5 ~]# zabbix_get -s 10.11.0.210 -p -k "total.processes"
zabbix监控php-fpm模板
<?xml version="1.0" encoding="UTF-8"?>
<zabbix_export>
<version>3.2</version>
<date>2019-07-09T03:30:42Z</date>
<groups>
<group>
<name>Templates</name>
</group>
</groups>
<templates>
<template>
<template>Template php-fpm</template>
<name>Template php-fpm</name>
<description/>
<groups>
<group>
<name>Templates</name>
</group>
</groups>
<applications>
<application>
<name>php-fpm</name>
</application>
</applications>
<items>
<item>
<name>accepted conn</name>
<type>0</type>
<snmp_community/>
<multiplier>0</multiplier>
<snmp_oid/>
<key>accepted.conn</key>
<delay>60</delay>
<history>90</history>
<trends>365</trends>
<status>0</status>
<value_type>3</value_type>
<allowed_hosts/>
<units>k</units>
<delta>1</delta>
<snmpv3_contextname/>
<snmpv3_securityname/>
<snmpv3_securitylevel>0</snmpv3_securitylevel>
<snmpv3_authprotocol>0</snmpv3_authprotocol>
<snmpv3_authpassphrase/>
<snmpv3_privprotocol>0</snmpv3_privprotocol>
<snmpv3_privpassphrase/>
<formula>1</formula>
<delay_flex/>
<params/>
<ipmi_sensor/>
<data_type>0</data_type>
<authtype>0</authtype>
<username/>
<password/>
<publickey/>
<privatekey/>
<port/>
<description/>
<inventory_link>0</inventory_link>
<applications>
<application>
<name>php-fpm</name>
</application>
</applications>
<valuemap/>
<logtimefmt/>
</item>
<item>
<name>active processes</name>
<type>0</type>
<snmp_community/>
<multiplier>0</multiplier>
<snmp_oid/>
<key>active.processes</key>
<delay>60</delay>
<history>90</history>
<trends>365</trends>
<status>0</status>
<value_type>3</value_type>
<allowed_hosts/>
<units/>
<delta>0</delta>
<snmpv3_contextname/>
<snmpv3_securityname/>
<snmpv3_securitylevel>0</snmpv3_securitylevel>
<snmpv3_authprotocol>0</snmpv3_authprotocol>
<snmpv3_authpassphrase/>
<snmpv3_privprotocol>0</snmpv3_privprotocol>
<snmpv3_privpassphrase/>
<formula>1</formula>
<delay_flex/>
<params/>
<ipmi_sensor/>
<data_type>0</data_type>
<authtype>0</authtype>
<username/>
<password/>
<publickey/>
<privatekey/>
<port/>
<description/>
<inventory_link>0</inventory_link>
<applications>
<application>
<name>php-fpm</name>
</application>
</applications>
<valuemap/>
<logtimefmt/>
</item>
<item>
<name>http_code</name>
<type>0</type>
<snmp_community/>
<multiplier>0</multiplier>
<snmp_oid/>
<key>http_code</key>
<delay>300</delay>
<history>90</history>
<trends>180</trends>
<status>0</status>
<value_type>3</value_type>
<allowed_hosts/>
<units/>
<delta>0</delta>
<snmpv3_contextname/>
<snmpv3_securityname/>
<snmpv3_securitylevel>0</snmpv3_securitylevel>
<snmpv3_authprotocol>0</snmpv3_authprotocol>
<snmpv3_authpassphrase/>
<snmpv3_privprotocol>0</snmpv3_privprotocol>
<snmpv3_privpassphrase/>
<formula>1</formula>
<delay_flex>300/1-7,00:00-24:00</delay_flex>
<params/>
<ipmi_sensor/>
<data_type>0</data_type>
<authtype>0</authtype>
<username/>
<password/>
<publickey/>
<privatekey/>
<port/>
<description/>
<inventory_link>0</inventory_link>
<applications/>
<valuemap/>
<logtimefmt/>
</item>
<item>
<name>php-fpm_idle_processes</name>
<type>0</type>
<snmp_community/>
<multiplier>0</multiplier>
<snmp_oid/>
<key>idle.processe</key>
<delay>60</delay>
<history>90</history>
<trends>365</trends>
<status>0</status>
<value_type>3</value_type>
<allowed_hosts/>
<units/>
<delta>0</delta>
<snmpv3_contextname/>
<snmpv3_securityname/>
<snmpv3_securitylevel>0</snmpv3_securitylevel>
<snmpv3_authprotocol>0</snmpv3_authprotocol>
<snmpv3_authpassphrase/>
<snmpv3_privprotocol>0</snmpv3_privprotocol>
<snmpv3_privpassphrase/>
<formula>1</formula>
<delay_flex/>
<params/>
<ipmi_sensor/>
<data_type>0</data_type>
<authtype>0</authtype>
<username/>
<password/>
<publickey/>
<privatekey/>
<port/>
<description/>
<inventory_link>0</inventory_link>
<applications>
<application>
<name>php-fpm</name>
</application>
</applications>
<valuemap/>
<logtimefmt/>
</item>
<item>
<name>listen queue</name>
<type>0</type>
<snmp_community/>
<multiplier>0</multiplier>
<snmp_oid/>
<key>listen.queue</key>
<delay>60</delay>
<history>90</history>
<trends>365</trends>
<status>0</status>
<value_type>3</value_type>
<allowed_hosts/>
<units/>
<delta>0</delta>
<snmpv3_contextname/>
<snmpv3_securityname/>
<snmpv3_securitylevel>0</snmpv3_securitylevel>
<snmpv3_authprotocol>0</snmpv3_authprotocol>
<snmpv3_authpassphrase/>
<snmpv3_privprotocol>0</snmpv3_privprotocol>
<snmpv3_privpassphrase/>
<formula>1</formula>
<delay_flex/>
<params/>
<ipmi_sensor/>
<data_type>0</data_type>
<authtype>0</authtype>
<username/>
<password/>
<publickey/>
<privatekey/>
<port/>
<description/>
<inventory_link>0</inventory_link>
<applications>
<application>
<name>php-fpm</name>
</application>
</applications>
<valuemap/>
<logtimefmt/>
</item>
<item>
<name>listen queue len</name>
<type>0</type>
<snmp_community/>
<multiplier>0</multiplier>
<snmp_oid/>
<key>listen.queue.len</key>
<delay>60</delay>
<history>90</history>
<trends>365</trends>
<status>1</status>
<value_type>3</value_type>
<allowed_hosts/>
<units/>
<delta>0</delta>
<snmpv3_contextname/>
<snmpv3_securityname/>
<snmpv3_securitylevel>0</snmpv3_securitylevel>
<snmpv3_authprotocol>0</snmpv3_authprotocol>
<snmpv3_authpassphrase/>
<snmpv3_privprotocol>0</snmpv3_privprotocol>
<snmpv3_privpassphrase/>
<formula>1</formula>
<delay_flex/>
<params/>
<ipmi_sensor/>
<data_type>0</data_type>
<authtype>0</authtype>
<username/>
<password/>
<publickey/>
<privatekey/>
<port/>
<description/>
<inventory_link>0</inventory_link>
<applications>
<application>
<name>php-fpm</name>
</application>
</applications>
<valuemap/>
<logtimefmt/>
</item>
<item>
<name>max active processes</name>
<type>0</type>
<snmp_community/>
<multiplier>0</multiplier>
<snmp_oid/>
<key>max.active.processes</key>
<delay>90</delay>
<history>10</history>
<trends>90</trends>
<status>0</status>
<value_type>3</value_type>
<allowed_hosts/>
<units/>
<delta>0</delta>
<snmpv3_contextname/>
<snmpv3_securityname/>
<snmpv3_securitylevel>0</snmpv3_securitylevel>
<snmpv3_authprotocol>0</snmpv3_authprotocol>
<snmpv3_authpassphrase/>
<snmpv3_privprotocol>0</snmpv3_privprotocol>
<snmpv3_privpassphrase/>
<formula>1</formula>
<delay_flex/>
<params/>
<ipmi_sensor/>
<data_type>0</data_type>
<authtype>0</authtype>
<username/>
<password/>
<publickey/>
<privatekey/>
<port/>
<description/>
<inventory_link>0</inventory_link>
<applications>
<application>
<name>php-fpm</name>
</application>
</applications>
<valuemap/>
<logtimefmt/>
</item>
<item>
<name>max children reached</name>
<type>0</type>
<snmp_community/>
<multiplier>0</multiplier>
<snmp_oid/>
<key>max.children.reached</key>
<delay>60</delay>
<history>90</history>
<trends>365</trends>
<status>0</status>
<value_type>3</value_type>
<allowed_hosts/>
<units/>
<delta>1</delta>
<snmpv3_contextname/>
<snmpv3_securityname/>
<snmpv3_securitylevel>0</snmpv3_securitylevel>
<snmpv3_authprotocol>0</snmpv3_authprotocol>
<snmpv3_authpassphrase/>
<snmpv3_privprotocol>0</snmpv3_privprotocol>
<snmpv3_privpassphrase/>
<formula>1</formula>
<delay_flex/>
<params/>
<ipmi_sensor/>
<data_type>2</data_type>
<authtype>0</authtype>
<username/>
<password/>
<publickey/>
<privatekey/>
<port/>
<description/>
<inventory_link>0</inventory_link>
<applications>
<application>
<name>php-fpm</name>
</application>
</applications>
<valuemap/>
<logtimefmt/>
</item>
<item>
<name>slow requests</name>
<type>0</type>
<snmp_community/>
<multiplier>0</multiplier>
<snmp_oid/>
<key>slow.requests</key>
<delay>60</delay>
<history>90</history>
<trends>365</trends>
<status>0</status>
<value_type>3</value_type>
<allowed_hosts/>
<units/>
<delta>1</delta>
<snmpv3_contextname/>
<snmpv3_securityname/>
<snmpv3_securitylevel>0</snmpv3_securitylevel>
<snmpv3_authprotocol>0</snmpv3_authprotocol>
<snmpv3_authpassphrase/>
<snmpv3_privprotocol>0</snmpv3_privprotocol>
<snmpv3_privpassphrase/>
<formula>1</formula>
<delay_flex/>
<params/>
<ipmi_sensor/>
<data_type>2</data_type>
<authtype>0</authtype>
<username/>
<password/>
<publickey/>
<privatekey/>
<port/>
<description/>
<inventory_link>0</inventory_link>
<applications>
<application>
<name>php-fpm</name>
</application>
</applications>
<valuemap/>
<logtimefmt/>
</item>
<item>
<name>start since</name>
<type>0</type>
<snmp_community/>
<multiplier>0</multiplier>
<snmp_oid/>
<key>start.since</key>
<delay>60</delay>
<history>90</history>
<trends>365</trends>
<status>1</status>
<value_type>3</value_type>
<allowed_hosts/>
<units/>
<delta>1</delta>
<snmpv3_contextname/>
<snmpv3_securityname/>
<snmpv3_securitylevel>0</snmpv3_securitylevel>
<snmpv3_authprotocol>0</snmpv3_authprotocol>
<snmpv3_authpassphrase/>
<snmpv3_privprotocol>0</snmpv3_privprotocol>
<snmpv3_privpassphrase/>
<formula>1</formula>
<delay_flex/>
<params/>
<ipmi_sensor/>
<data_type>2</data_type>
<authtype>0</authtype>
<username/>
<password/>
<publickey/>
<privatekey/>
<port/>
<description/>
<inventory_link>0</inventory_link>
<applications>
<application>
<name>php-fpm</name>
</application>
</applications>
<valuemap/>
<logtimefmt/>
</item>
<item>
<name>total processes</name>
<type>0</type>
<snmp_community/>
<multiplier>0</multiplier>
<snmp_oid/>
<key>total.processes</key>
<delay>60</delay>
<history>90</history>
<trends>365</trends>
<status>1</status>
<value_type>3</value_type>
<allowed_hosts/>
<units/>
<delta>0</delta>
<snmpv3_contextname/>
<snmpv3_securityname/>
<snmpv3_securitylevel>0</snmpv3_securitylevel>
<snmpv3_authprotocol>0</snmpv3_authprotocol>
<snmpv3_authpassphrase/>
<snmpv3_privprotocol>0</snmpv3_privprotocol>
<snmpv3_privpassphrase/>
<formula>1</formula>
<delay_flex/>
<params/>
<ipmi_sensor/>
<data_type>0</data_type>
<authtype>0</authtype>
<username/>
<password/>
<publickey/>
<privatekey/>
<port/>
<description/>
<inventory_link>0</inventory_link>
<applications>
<application>
<name>php-fpm</name>
</application>
</applications>
<valuemap/>
<logtimefmt/>
</item>
<item>
<name>up</name>
<type>0</type>
<snmp_community/>
<multiplier>0</multiplier>
<snmp_oid/>
<key>up</key>
<delay>90</delay>
<history>10</history>
<trends>90</trends>
<status>0</status>
<value_type>3</value_type>
<allowed_hosts/>
<units/>
<delta>0</delta>
<snmpv3_contextname/>
<snmpv3_securityname/>
<snmpv3_securitylevel>0</snmpv3_securitylevel>
<snmpv3_authprotocol>0</snmpv3_authprotocol>
<snmpv3_authpassphrase/>
<snmpv3_privprotocol>0</snmpv3_privprotocol>
<snmpv3_privpassphrase/>
<formula>1</formula>
<delay_flex/>
<params/>
<ipmi_sensor/>
<data_type>0</data_type>
<authtype>0</authtype>
<username/>
<password/>
<publickey/>
<privatekey/>
<port/>
<description/>
<inventory_link>0</inventory_link>
<applications>
<application>
<name>php-fpm</name>
</application>
</applications>
<valuemap/>
<logtimefmt/>
</item>
</items>
<discovery_rules/>
<httptests/>
<macros>
<macro>
<macro>{$PHP_FPM_STATUS_URL}</macro>
<value>http://127.0.0.1:10061/php-fpm_status</value>
</macro>
</macros>
<templates/>
<screens/>
</template>
</templates>
<triggers>
<trigger>
<expression>{Template php-fpm:http_code.max(#2)}<>200</expression>
<recovery_mode>0</recovery_mode>
<recovery_expression/>
<name>php-fpm http status code not 200</name>
<correlation_mode>0</correlation_mode>
<correlation_tag/>
<url/>
<status>0</status>
<priority>2</priority>
<description/>
<type>0</type>
<manual_close>0</manual_close>
<dependencies/>
<tags/>
</trigger>
<trigger>
<expression>{Template php-fpm:up.last()}=0</expression>
<recovery_mode>0</recovery_mode>
<recovery_expression/>
<name>php-fpm was down</name>
<correlation_mode>0</correlation_mode>
<correlation_tag/>
<url/>
<status>0</status>
<priority>0</priority>
<description/>
<type>0</type>
<manual_close>0</manual_close>
<dependencies/>
<tags/>
</trigger>
</triggers>
<graphs>
<graph>
<name>php-fpm_status</name>
<width>900</width>
<height>200</height>
<yaxismin>0.0000</yaxismin>
<yaxismax>100.0000</yaxismax>
<show_work_period>1</show_work_period>
<show_triggers>1</show_triggers>
<type>0</type>
<show_legend>1</show_legend>
<show_3d>0</show_3d>
<percent_left>0.0000</percent_left>
<percent_right>0.0000</percent_right>
<ymin_type_1>0</ymin_type_1>
<ymax_type_1>0</ymax_type_1>
<ymin_item_1>0</ymin_item_1>
<ymax_item_1>0</ymax_item_1>
<graph_items>
<graph_item>
<sortorder>0</sortorder>
<drawtype>0</drawtype>
<color>C800C8</color>
<yaxisside>0</yaxisside>
<calc_fnc>2</calc_fnc>
<type>0</type>
<item>
<host>Template php-fpm</host>
<key>active.processes</key>
</item>
</graph_item>
<graph_item>
<sortorder>1</sortorder>
<drawtype>0</drawtype>
<color>00C8C8</color>
<yaxisside>0</yaxisside>
<calc_fnc>2</calc_fnc>
<type>0</type>
<item>
<host>Template php-fpm</host>
<key>listen.queue</key>
</item>
</graph_item>
<graph_item>
<sortorder>2</sortorder>
<drawtype>0</drawtype>
<color>C8C800</color>
<yaxisside>0</yaxisside>
<calc_fnc>2</calc_fnc>
<type>0</type>
<item>
<host>Template php-fpm</host>
<key>listen.queue.len</key>
</item>
</graph_item>
<graph_item>
<sortorder>3</sortorder>
<drawtype>0</drawtype>
<color>C8C8C8</color>
<yaxisside>0</yaxisside>
<calc_fnc>2</calc_fnc>
<type>0</type>
<item>
<host>Template php-fpm</host>
<key>max.active.processes</key>
</item>
</graph_item>
<graph_item>
<sortorder>4</sortorder>
<drawtype>0</drawtype>
<color>960000</color>
<yaxisside>0</yaxisside>
<calc_fnc>2</calc_fnc>
<type>0</type>
<item>
<host>Template php-fpm</host>
<key>idle.processe</key>
</item>
</graph_item>
<graph_item>
<sortorder>5</sortorder>
<drawtype>0</drawtype>
<color>000096</color>
<yaxisside>0</yaxisside>
<calc_fnc>2</calc_fnc>
<type>0</type>
<item>
<host>Template php-fpm</host>
<key>total.processes</key>
</item>
</graph_item>
</graph_items>
</graph>
</graphs>
</zabbix_export>
监控一台服务器运行多个php程序状态码
# 对应的php-fpm.conf修改
php5.6.30
pm.status_path = /php5_status
php7.0.30
pm.status_path = /php7_status
# nginx的配置
location ~ ^/(php5_status|php5_ping)$ {
include fastcgi_params;
fastcgi_pass unix:/tmp/php5.6.30.sock;
fastcgi_param SCRIPT_FILENAME $fastcgi_script_name;
}
location ~ ^/(php7_status|php7_ping)$ {
include fastcgi_params;
fastcgi_pass unix:/tmp/php7.0.30.sock;
fastcgi_param SCRIPT_FILENAME $fastcgi_script_name;
}
# 监控项
UserParameter=php5_status,curl -s -k --connect-timeout 10 -m 4 -o /dev/null -w %{http_code} "http://127.0.0.1/php5_status"
UserParameter=php7_status,curl -s -k --connect-timeout 10 -m 4 -o /dev/null -w %{http_code} "http://127.0.0.1/php7_status"
zabbix3监控php-fpm的状态的更多相关文章
- [记录]Zabbix3.4配置监控Oracle12c的存活状态和表空间使用率
Zabbix3.4配置监控Oracle的存活状态和表空间使用率 1.安装zabbix3.4 agent: # rpm -ivh http://repo.zabbix.com/zabbix/3.4/rh ...
- 监控mysql主从同步状态脚本
监控mysql主从同步状态脚本 示例一: cat check_mysql_health #!/bin/sh slave_is=($(mysql -S /tmp/mysql3307.sock -uroo ...
- 采用Opserver来监控你的ASP.NET项目系列(三、监控你的服务器状态)
前言 之前有过2篇关于如何监控ASP.NET core项目的文章,有兴趣的也可以看看. 今天我们主要来介绍一下,如何使用Opserver监控我们的服务器状态. Opserver的功能其实很强大,他可以 ...
- shell习题第8题:监控nginx的502状态
[题目要求] 服务器上跑的是LNMP环境,近期总是有502现象.502为网站访问的状态码,200正常,502错误是nginx最为普遍的错误状态码. 由于502只是暂时的,并且只要一重启php-fpm服 ...
- 监控mysql主从同步状态是否异常
监控mysql主从同步状态是否异常,如果异常,则发生短信或邮寄给管理员 标签:监控mysql主从同步状态是否异常 阶段1:开发一个守护进程脚本每30秒实现检测一次. 阶段2:如果同步出现如下错误号(1 ...
- 脚本_监控 HTTP 服务器的状态
#!bin/bash#功能:监控 HTTP 服务器的状态(测试返回码) #作者:liusingbon#设置变量,url 为你需要检测的目标网站的网址(IP 或域名)url=http://192.168 ...
- 监控Linux服务器网站状态的SHELL脚本
1,监控httpd状态码的shell脚本代码. #!/bin/sh #site: www.jquerycn.cn # website[0]=www.jquerycn.cn/chuzu/' #网站1 m ...
- 监控 HTTP 服务器的状态(测试返回码)shell脚本
#!/bin/bash # 监控 HTTP 服务器的状态(测试返回码) # 设置变量,url为你需要检测的目标网站的网址(IP 或域名),比如百度 url=http://http://183.232. ...
- zabbix3.2.4监控MySQL5.7.16状态
一.添加监控用户mysql> grant all privileges on *.* to 'zabbix'@'localhost' identified by 'zabbix';mysql&g ...
随机推荐
- idea使用maven打包项目
第一步:打开maven Projects 第二步.找到package 第三步,运行.到路径下面去找打包的文件吧. 第二种方法: 使用命令 cmd进入项目目录,例如项目在D盘项目名poject 输入: ...
- hadoop的基本概念 伪分布式hadoop集群的安装 hdfs mapreduce的演示
hadoop 解决问题: 海量数据存储(HDFS) 海量数据的分析(MapReduce) 资源管理调度(YARN)
- listView item分割线不显示
在华为平板上列表上分割线第一个不显示,增大dividerHeight代码解决 <ListView android:id="@+id/list_view" android:di ...
- C#窗口闪烁问题解决
https://www.cnblogs.com/AndyDai/p/5203798.html 开发WinForm 程序时经常会遇到闪屏的问题,这会给用户造成很差的使用体验,所以必须妥善解决好这个问题. ...
- C# 异步方法(AM)
Ø 前言 C# Asynchronous Programming(异步编程)有几种实现方式,其中 Asynchronous Method(异步方法)就是其中的一种.异步方法是 C#5.0 才有的新特 ...
- 在Linux上安装Git
Git是一个开源的分布式版本控制系统,可以有效.高速的处理从很小到非常大的项目版本管理.而国外的GitHub和国内的Coding都是项目的托管平台.但是在使用Git工具的时候,第一步要学会如何安装gi ...
- sql库连sql中间库连orcle库增删改查方案
---中间库建立存储过程create procedure Proc_exec@SQL nvarchar(MAX)ASexec(@SQL) GO---web服务器执行语句 --查 select * fr ...
- ubuntu安装GBK编码
1 添加GBK编码 sudo vim /var/lib/locales/supported.d/local en_US.UTF-8 UTF-8 zh_CN.UTF-8 UTF-8 zh_CN.GBK ...
- whatis命令,一个非常有用的命令
比如我不知道yum的配置文件yum.conf怎么用,就可以whatis yum.conf,
- Gulp简明使用教程
Glup用自动化构建工具增强你的工作流程! 同类型的软件还有Grunt.关于两者的区别可以参考这篇文章Grunt VS Gulp 安装: $ npm install gulp -g $ npm ins ...