zabbix监控php-fpm的性能
2017-10-27 17:34
447 查看
zabbix监控php-fpm主要是通过nginx配置php-fpm的状态输出页面,在正则取值
要nginx能输出php-fpm的状态必须要先修改php-fpm的配置,这个配置没有开启nginx 就没有办法输出php-fpm status
修改/usr/local/php/etc/php-fpm.conf 文件
注意:不是php.ini,如果没有配置添加配置
pm.status_path = /status
重启php-fpm
service php-fpm restart
添加nginx的配置
打开/usr/local/nginx/conf/nginx.conf
配置好之后重启一下nginx
service nginx restart
添加监控的shlle脚本
php-fpm_status.sh
添加zabbix-agent配置
php-fpm_status.conf
重启zabbix-agent
service zabbix-agent restart
测试
zabbix_get -s 127.0.0.1 -k slow.requests
如果没有问题导入模板
php-fpm_status.xml
现在就能看到数据了
脚本和模板如下:
要nginx能输出php-fpm的状态必须要先修改php-fpm的配置,这个配置没有开启nginx 就没有办法输出php-fpm status
修改/usr/local/php/etc/php-fpm.conf 文件
注意:不是php.ini,如果没有配置添加配置
pm.status_path = /status
重启php-fpm
service php-fpm restart
添加nginx的配置
打开/usr/local/nginx/conf/nginx.conf
location ~ \.php|^/status$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_connect_timeout 180; fastcgi_read_timeout 600; fastcgi_send_timeout 600; include fastcgi.conf; }
配置好之后重启一下nginx
service nginx restart
添加监控的shlle脚本
php-fpm_status.sh
添加zabbix-agent配置
php-fpm_status.conf
重启zabbix-agent
service zabbix-agent restart
测试
zabbix_get -s 127.0.0.1 -k slow.requests
如果没有问题导入模板
php-fpm_status.xml
现在就能看到数据了
脚本和模板如下:
vim php-fpm_status.sh #!/bin/bash listenqueue(){ wget --quiet -O - http://127.0.0.1:80/status?auto |grep "listen queue:"|grep -vE "len|max"|awk '{print$3}' } listenqueuelen(){ wget --quiet -O - http://127.0.0.1:80/status?auto |grep "listen queue len" |awk '{print$4}' } idle(){ wget --quiet -O - http://127.0.0.1:80/status?auto |grep "idle processes" |awk '{print$3}' } active(){ wget --quiet -O - http://127.0.0.1:80/status?auto |grep "active" |awk '{print$3}'|grep -v "process" } total(){ wget --quiet -O - http://127.0.0.1:80/status?auto |grep "total processes" |awk '{print$3}' } mactive(){ wget --quiet -O - http://127.0.0.1:80/status?auto |grep "max active processes:" |awk '{print$4}' } since(){ wget --quiet -O - http://127.0.0.1:80/status?auto |grep "start since: " |awk '{print$3}' } conn(){ wget --quiet -O - http://127.0.0.1:80/status?auto |grep "accepted conn" |awk '{print$3}' } reached(){ wget --quiet -O - http://127.0.0.1:80/status?auto |grep "max children reached" |awk '{print$4}' } requests(){ wget --quiet -O - http://127.0.0.1:80/status?auto |grep "slow requests" |awk '{print$3}' } $1
vim php-fpm_status.conf UserParameter=idle.processe,/scripts/php-fpm_status.sh idle UserParameter=total.processes,/scripts/php-fpm_status.sh total UserParameter=active.processes,/scripts/php-fpm_status.sh active UserParameter=max.active.processes,/scripts/php-fpm_status.sh mactive UserParameter=listen.queue.len,/scripts/php-fpm_status.sh listenqueuelen UserParameter=listen.queue,/scripts/php-fpm_status.sh listenqueue UserParameter=start.since,/scripts/php-fpm_status.sh since UserParameter=accepted.conn,/scripts/php-fpm_status.sh conn UserParameter=max.children.reached,/scripts/php-fpm_status.sh reached UserParameter=slow.requests,/scripts/php-fpm_status.sh requests
相关文章推荐
- zabbix 监控php-fpm 性能
- zabbix监控redis、mysql状态、php-fpm性能状态
- zabbix监控php-fpm性能状态
- 使用zabbix监控nginx和php-fpm性能
- zabbix监控php-fpm性能状态
- zabbix监控php-fpm
- zabbix监控nginx、php-fpm的状态
- zabbix监控php-fpm模板
- Zabbix监控php-fpm status
- zabbix通过自定义脚本监控nginx,php-fpm和mysql占用内存数和进程的个数
- zabbix 监控php-fpm
- Zabbix监控Nginx 和PHP-FPM状态
- zabbix监控nginx、php-fpm的状态
- Zabbix监控Memcached PHP-FPM Tomcat Nginx MySQL 网站日志
- zabbix实战--Php-fpm监控详解
- zabbix监控phpfpm
- zabbix 监控phpfpm_status
- zabbix如何监控php-fpm
- zabbix通过自定义脚本监控nginx,php-fpm和mysql占用内存数和进程的个数