Nginx自带监控模块ngx_http_stub_status_module提供Nginx的基本信息
在编译安装Nginx时加参数 --with-http_stub_status_module
安装好以后可以通过nginx -V|grep http_stub_status_module 查看状态模块是否已安装
PHP-FPM也自带监控,通过在php-fpm.conf中设置
pm.status_path = /php-fpm_status
就可以获取URL的方式获取PHP-FPM的状态
添加nginx_status.conf
server { listen 80 ; location /nginx_status { stub_status on; access_log off; allow 127.0.0.1; # allow 10.4.1.125; deny all; } location /php-fpm_status { fastcgi_pass 127.0.0.1:9000; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } }
$ curl 127.0.0.1/nginx_status Active connections: 1 server accepts handled requests 788163 788163 788163 Reading: 0 Writing: 1 Waiting: 0
Active connections
The current number of active client connections including Waiting
connections.
活跃客户端连接数,包括处于等待状态的连接数
accepts
The total number of accepted client connections.
接收到的客户端连接总数
handled
The total number of handled connections. Generally, the parameter value is the same as accepts
unless some resource limits have been reached
处理请求的总数。通常情况下,这个值和accepts的值相同。除非达到了一些资源限制。例如设置worker_connections 1024; 设置一个worker进程能够打开的最大并发连接数。
requests
The total number of client requests.
客户端请求总数
Reading
The current number of connections where nginx is reading the request header.
当前Nginx正在读取请求头的连接数量
Writing
The current number of connections where nginx is writing the response back to the client.
当前Nginx正在将响应写回到客户端的连接数量
Waiting
The current number of idle client connections waiting for a request.
当前正在等待请求的闲置客户端连接数量
$ curl 127.0.0.1/php-fpm_status pool: www process manager: dynamic start time: 16/Nov/2014:13:29:11 +0800 start since: 77844 accepted conn: 202788 listen queue: 0 max listen queue: 1 listen queue len: 128 idle processes: 6 active processes: 1 total processes: 7 max active processes: 4 max children reached: 0 slow requests: 0
pool pool名称
process manager static or dynamic
start time 启动时间
start since 启动了多长时间,以秒为单位
accepted conn pool接收到的请求数量
idle processes 空闲进程数量
listen queue the number of request in the queue of pending connections. If this number is non-zero, then you better increase number of process FPM can spawn.
本文出自 “Linux SA John” 博客,请务必保留此出处http://john88wang.blog.51cto.com/2165294/1577269
原文地址:http://john88wang.blog.51cto.com/2165294/1577269