Home > Backend Development > PHP Tutorial > zabbix 监控php-fpm 性能

zabbix 监控php-fpm 性能

WBOY
Release: 2016-06-23 13:04:51
Original
985 people have browsed it



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


       

                http://www.ttlsa.com/php/use-php-fpm-status-page-detail/

               http://www.ttlsa.com/zabbix/zabbix-monitor-php-fpm-status/



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 "" | awk -F'>|


 killall zabbix_agentd

/usr/local/zabbix/sbin/zabbix_agentd 


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


模板下载地址

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

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


Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template