继续浏览精彩内容
慕课网APP
程序员的梦工厂
打开
继续
感谢您的支持,我会继续努力的
赞赏金额会直接到老师账户
将二维码发送给自己后长按识别
微信支付
支付宝支付

zabbix 监控php-fpm 性能

这个名字没人起
关注TA
已关注
手记 271
粉丝 19
获赞 92

首先需要开启php-fpm状态功能 

vim /usr/local/php/etc/php-fpm.conf

pm.status_path = /status  去掉注释

vim /etc/nginx/vhost/web.conf 

server

        {

                listen       80;

                server_name 192.168.80.62;

                index index.php index.html index.htm default.html default.htm default.php;

                root  /usr/local/nginx/html;

location ~ .*\.(php|php5)?$

                        {

                                fastcgi_pass  127.0.0.1:9000;

                                fastcgi_index index.php;

                                include /etc/nginx/fastcgi_params;

                        }


               location ~ ^/(status|ping)$    #加上红色部分

    {

        include fastcgi_params;

        fastcgi_pass 127.0.0.1:9000;

        fastcgi_param SCRIPT_FILENAME $fastcgi_script_name;

    }


                   location /ngx_status {

                        stub_status on;

                        access_log   off;

                }


                location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$

                        {

                                expires      30d;

                        }

                location ~ .*\.(js|css)?$

                        {

                                expires      12h;

                        }


                access_log off;

        }

                                                                                 

重启php-fpm 


pkill php-fpm

/usr/local/php/sbin/php-fpm


测试如下ok


[root@zabbixserver ~]# curl http://127.0.0.1/status

pool:                 www

process manager:      dynamic

start time:           18/May/2016:07:04:35 +0800

start since:          715765

accepted conn:        21386

listen queue:         0

max listen queue:     1

listen queue len:     128

idle processes:       5

active processes:     1

total processes:      6

max active processes: 6

max children reached: 0

slow requests:        0


zabbix客户端配置key


vim /usr/local/zabbix/etc/zabbix_agentd.conf

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


 killall zabbix_agentd

/usr/local/zabbix/sbin/zabbix_agentd 


最后在zabbix-server 导入模板连接模板即可


模板下载地址

zabbix监控php-fpm模板-zabbix 3.x

zabbix监控php-fpm模板-zabbix 2.x


打开App,阅读手记
0人推荐
发表评论
随时随地看视频慕课网APP