nginx״̬Ôõô²é
linux ϵͳÉÏÉó²é nginx ״̬µÄÒªÁ죺ʹÓà nginx ״̬ģ¿é£º×°ÖÃÄ£¿é¡¢ÆôÓÃÄ£¿é¡¢ÖØÆô nginx£¬»á¼û /nginx_status url Éó²éÐÅÏ¢£»Ê¹Óà curl£ºcurl http://localhost/nginx_status »ñÈ¡ nginx ״̬ÐÅÏ¢£»Ê¹ÓõÚÈý·½¹¤¾ß nginxtop£º×°Öà nginxtop ²¢ÔËÐÐÏà¹ØÏÂÁîÉó²é nginx ʵʱÐÅÏ¢¡£×´Ì¬ÐÅϢͨ³£°üÀ¨»îÔ¾ÅþÁ¬Êý¡¢ÇëÇóÊý¡¢´¦Àíʱ¼ä¡¢ÄÚ´æºÍ cpu ʹÓÃÇéÐεÈÖ¸±ê¡£
ÔõÑùÉó²é Nginx ״̬
Nginx ÊÇÒ»ÖÖÊ¢ÐÐµÄ Web ЧÀÍÆ÷£¬ÎªÁËÈ·±£ÆäƽÎÈÔËÐУ¬°´ÆÚ¼ì²éÆä״̬ÖÁ¹ØÖ÷Òª¡£ÒÔÏÂÊÇÔÚ Linux ϵͳÉÏÉó²é Nginx ״̬µÄ²î±ðÒªÁ죺
ÒªÁì 1£ºÊ¹Óà Nginx ״̬ģ¿é
Nginx ״̬ģ¿éÊÇÒ»¸öÄÚÖÃÄ£¿é£¬ÌṩÓйØЧÀÍÆ÷״̬µÄʵʱÐÅÏ¢¡£ÒªÊ¹ÓÃËü£º
×°Öà Nginx ״̬ģ¿é£ºsudo apt-get install nginx-extras
ÆôÓÃ״̬ģ¿é£ºÔÚ Nginx ÉèÖÃÎļþÖУ¨Í¨³£Î»ÓÚ /etc/nginx/nginx.conf£©ÖУ¬Ìí¼ÓÈçÏÂÐУº
location /nginx_status { stub_status on; access_log off; allow all; }
µÇ¼ºó¸´ÖÆ
ÖØÆô Nginx£ºsudo systemctl restart nginx
ÔÚä¯ÀÀÆ÷Öлá¼û /nginx_status URL£¬¼´¿ÉÉó²é״̬ÐÅÏ¢¡£
ÒªÁì 2£ºÊ¹Óà Curl
Curl ÊÇÒ»¸öÏÂÁîÐй¤¾ß£¬¿ÉÒÔÓÃÀ´´Ó URL »ñÈ¡Êý¾Ý¡£ÒªÊ¹ÓÃËü¼ì²é Nginx ״̬£º
curl http://localhost/nginx_status
µÇ¼ºó¸´ÖÆ
ÒªÁì 3£ºÊ¹Óà Nginxtop
Nginxtop ÊÇÒ»¸öµÚÈý·½¹¤¾ß£¬¿ÉÒÔÌṩÓÐ¹Ø Nginx ЧÀÍÆ÷µÄʵʱÐÅÏ¢¡£ÒªÊ¹ÓÃËü£º
×°Öà Nginxtop£ºsudo apt-get install nginxtop
ÔËÐÐ Nginxtop ÏÂÁsudo nginxtop
״̬ÐÅÏ¢Ú¹ÊÍ
Nginx ״̬ÐÅϢͨ³£°üÀ¨ÒÔÏÂÖ¸±ê£º
»îÔ¾ÅþÁ¬Êý
ÇëÇóÊý
´¦Àíʱ¼ä
ÄÚ´æʹÓÃÇéÐÎ
CPU ʹÓÃÂÊ
°´ÆÚ¼ì²éÕâЩָ±ê¿ÉÒÔ×ÊÖúÄãÏàʶ Nginx µÄÐÔÄܺͿµ½¡×´Ì¬£¬²¢ÔÚ·ºÆðÎÊÌâʱʵʱ·¢Ã÷²¢½â¾ö¡£
ÒÔÉϾÍÊÇnginx״̬Ôõô²éµÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡