標籤:nginx zabbix php-fpm
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_statusActive 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_statuspool: wwwprocess manager: dynamicstart time: 16/Nov/2014:13:29:11 +0800start since: 77844accepted conn: 202788listen queue: 0max listen queue: 1listen queue len: 128idle processes: 6active processes: 1total processes: 7max active processes: 4max children reached: 0slow 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
Zabbix監控Nginx 和PHP-FPM狀態