您好,登錄后才能下訂單哦!
這篇文章將為大家詳細(xì)講解有關(guān)怎么用php-fpm的status查看詳細(xì)信息,小編覺得挺實(shí)用的,因此分享給大家做個(gè)參考,希望大家閱讀完這篇文章后可以有所收獲。
php-fpm的status可以查看匯總信息和詳細(xì)信息
nginx.conf 配置文件
server { listen 80; server_name localhost; index index.php index.html; root /home/tinywan/zabbix; location / { try_files $uri $uri/ /index.php?$args; } location ~ \.php$ { fastcgi_pass unix:/var/run/php7.0.9-fpm.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } location /nginx_status { stub_status on; access_log off; allow 127.0.0.1; ##allow 192.168.249.0/24; deny all; } location ~ /php_fpm-status$ { allow 127.0.0.1; #deny all; fastcgi_param SCRIPT_FILENAME $fastcgi_script_name; include fastcgi_params; fastcgi_pass unix:/var/run/php7.0.9-fpm.sock; } }
啟用php-fpm狀態(tài)功能
tinywan@tinywan:/opt/php-7.0.9$ cat /opt/php-7.0.9/etc/php-fpm.d/www.conf | grep status_path ;pm.status_path = /status
默認(rèn)情況下為/status,當(dāng)然也可以改成其他的,例如/ttlsa_status等等。
vim /opt/php-7.0.9/etc/php-fpm.d/www.conf pm.status_path = /php_fpm-status #去掉了前面的;注釋符,并更名為php_fpm-status
修改完php-fpm.conf后,使用service php-fpm reload重新加載配置文件
tinywan@tinywan:/opt/php-7.0.9$ sudo /opt/php-7.0.9/sbin/php-fpm tinywan@tinywan:/opt/php-7.0.9$ ps -aux | grep php-fpm root 2769 4.1 0.1 212532 14676 ? Ss 09:50 0:00 php-fpm: master process (/opt/php-7.0.9/etc/php-fpm.conf) tinywan 2770 3.2 0.1 212532 11084 ? S 09:50 0:00 php-fpm: pool www tinywan 2771 5.9 0.1 212532 11084 ? S 09:50 0:00 php-fpm: pool www tinywan 2773 0.0 0.0 15984 944 pts/21 S+ 09:50 0:00 grep --color=auto php-fpm
使用curl指令查看php-fpm的status
tinywan@tinywan:/usr/local/nginx$ curl localhost/php_fpm-status pool: www process manager: dynamic start time: 13/May/2017:09:50:43 +0800 start since: 986 accepted conn: 2 listen queue: 0 max listen queue: 0 listen queue len: 0 idle processes: 1 active processes: 1 total processes: 2 max active processes: 1 max children reached: 0 slow requests: 0
php-fpm的status可以查看匯總信息和詳細(xì)信息,詳細(xì)信息比匯總信息要多出每一個(gè)php-fpm進(jìn)程的相關(guān)信息,同時(shí)支持多種格式輸出,如xml、html和json,默認(rèn)情況下分別使用如果指令即可:
json格式
tinywan@tinywan:~$ curl localhost/php_fpm-status?json {"pool":"www","process manager":"dynamic","start time":1494640243, "start since":1609,"accepted conn":13,"listen queue":0,"max listen queue":0, "listen queue len":0,"idle processes":1,"active processes":1,"total processes":2, "max active processes":1,"max children reached":0,"slow requests":0}
xml格式
tinywan@tinywan:~$ curl localhost/php_fpm-status?xml <?xml version="1.0" ?> <status> <pool>www</pool> <process-manager>dynamic</process-manager> <start-time>1494640243</start-time> <start-since>1692</start-since> <accepted-conn>15</accepted-conn> <listen-queue>0</listen-queue> <max-listen-queue>0</max-listen-queue> <listen-queue-len>0</listen-queue-len> <idle-processes>1</idle-processes> <active-processes>1</active-processes> <total-processes>2</total-processes> <max-active-processes>1</max-active-processes> <max-children-reached>0</max-children-reached> <slow-requests>0</slow-requests> </status>
所有格式:
Examples for summary status page: http://127.0.0.1/php_fpm-status http://127.0.0.1/php_fpm-status?json http://127.0.0.1/php_fpm-status?html http://127.0.0.1/php_fpm-status?xml Example for detailed status page: http://127.0.0.1/php_fpm-status?full http://127.0.0.1/php_fpm-status?json&full http://127.0.0.1/php_fpm-status?html&full http://127.0.0.1/php_fpm-status?xml&full
瀏覽器訪問xml文件截圖
php-fpm status的含義
字段 | 含義 |
---|---|
pool | php-fpm pool的名稱,大多數(shù)情況下為www |
process manager | 進(jìn)程管理方式,現(xiàn)今大多都為dynamic,不要使用static |
start time | php-fpm上次啟動(dòng)的時(shí)間 |
start since | php-fpm已運(yùn)行了多少秒 |
accepted conn | pool接收到的請(qǐng)求數(shù) |
listen queue | 處于等待狀態(tài)中的連接數(shù),如果不為0,需要增加php-fpm進(jìn)程數(shù) |
max listen queue | 從php-fpm啟動(dòng)到現(xiàn)在處于等待連接的最大數(shù)量 |
listen queue len | 處于等待連接隊(duì)列的套接字大小 |
idle processes | 處于空閑狀態(tài)的進(jìn)程數(shù) |
active processes | 處于活動(dòng)狀態(tài)的進(jìn)程數(shù) |
total processess | 進(jìn)程總數(shù) |
max active process | 從php-fpm啟動(dòng)到現(xiàn)在最多有幾個(gè)進(jìn)程處于活動(dòng)狀態(tài) |
max children reached | 當(dāng)pm試圖啟動(dòng)更多的children進(jìn)程時(shí),卻達(dá)到了進(jìn)程數(shù)的限制,達(dá)到一次記錄一次,如果不為0,需要增加php-fpm pool進(jìn)程的最大數(shù) |
slow requests | 當(dāng)啟用了php-fpm slow-log功能時(shí),如果出現(xiàn)php-fpm慢請(qǐng)求這個(gè)計(jì)數(shù)器會(huì)增加,一般不當(dāng)?shù)?a title="Mysql" target="_blank" href="http://kemok4.com/mysql/">Mysql查詢會(huì)觸發(fā)這個(gè)值 |
關(guān)于“怎么用php-fpm的status查看詳細(xì)信息”這篇文章就分享到這里了,希望以上內(nèi)容可以對(duì)大家有一定的幫助,使各位可以學(xué)到更多知識(shí),如果覺得文章不錯(cuò),請(qǐng)把它分享出去讓更多的人看到。
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。