php-fpm和nginx一样内建了一个状态页,对于想了解php-fpm的状态以及监控php-fpm非常有帮助。为了后续的zabbix监控,我们需要先了解php-fpm状态页是怎么回事。 1. 启用php-fpm状态功能 # cat? /usr/local/php-5.5.10/etc/php-fpm.conf | grep status_pathpm.s
php-fpm和nginx一样内建了一个状态页,对于想了解php-fpm的状态以及监控php-fpm非常有帮助。为了后续的zabbix监控,我们需要先了解php-fpm状态页是怎么回事。 1. 启用php-fpm状态功能
# cat? /usr/local/php-5.5.10/etc/php-fpm.conf | grep status_path pm.status_path = /status
server { ??? listen? *:80 default_server; ??? server_name _; ??? location ~ ^/(status|ping)$ ??? { ?? ??? ?include fastcgi_params; ?? ??? ?fastcgi_pass 127.0.0.1:9000; ?? ??? ?fastcgi_param SCRIPT_FILENAME $fastcgi_script_name; ??? } }
# service nginx restart # service php-fpm restart
# curl http://www.ttlsa.com/status pool:???????????????? www process manager:????? dynamic start time:?????????? 14/May/2014:22:40:15 +0800 start since:????????? 58508 accepted conn:??????? 33 listen queue:???????? 0 max listen queue:???? 8 listen queue len:???? 0 idle processes:?????? 2 active processes:???? 1 total processes:????? 3 max active processes: 5 max children reached: 0 slow requests:??????? 2091
# curl http://127.0.0.1/status?json {"pool":"www","process manager":"dynamic","start time":1400078415,"start since":59624,"accepted conn":27,"listen queue":0,"max listen queue":8,"listen queue len":0,"idle processes":2,"active processes":1,"total processes":3,"max active processes":5,"max children reached":0,"slow requests":2145}
# curl http://127.0.0.1/status?xml <?xml version="1.0" ?> www dynamic 1400078415 59640 36 0 8 0 2 1 3 5 0 2145
# curl http://127.0.0.1/status?html PHP-FPM Status Page poolwww process managerdynamic start time14/May/2014:22:40:15 +0800 start since59662 accepted conn8 listen queue0 max listen queue8 listen queue len0 idle processes2 active processes1 total processes3 max active processes5 max children reached0 slow requests2147
# curl http://127.0.0.1/status?full pool:???????????????? www process manager:????? dynamic start time:?????????? 14/May/2014:22:40:15 +0800 start since:????????? 59695 accepted conn:??????? 1 listen queue:???????? 0 max listen queue:???? 8 listen queue len:???? 0 idle processes:?????? 2 active processes:???? 1 total processes:????? 3 max active processes: 5 max children reached: 0 slow requests:??????? 2148 ************************ pid:????????????????? 29050 state:??????????????? Idle start time:?????????? 15/May/2014:15:09:32 +0800 start since:????????? 338 requests:???????????? 62 request duration:???? 1025585 request method:?????? GET request URI:????????? /index.php content length:?????? 0 user:???????????????? - script:?????????????? /data/site/www.ttlsa.com/index.php last request cpu:???? 45.83 last request memory:? 24903680 .....省略几个PID....
原文地址:启用php-fpm状态详解, 感谢原作者分享。