Linux CPUϵͳ×ÊÔ´Õ¼Óùý¸ßÎÊÌâÆÊÎö
Linux CPUϵͳ×ÊÔ´Õ¼Óùý¸ßÎÊÌâÆÊÎö
ÔÚÒ»Ñùƽ³£Ê¹ÓÃLinuxϵͳµÄÀú³ÌÖУ¬ÎÒÃÇ¿ÉÄÜ»áÓöµ½CPU×ÊÔ´Õ¼Óùý¸ßµÄÎÊÌ⣬Õâ»áµ¼ÖÂϵͳÏìÓ¦±äÂýÉõÖÁÓ°ÏìϵͳµÄÕý³£ÔËÐС£±¾ÎĽ«ÉîÈëÆÊÎöLinuxϵͳÖÐCPU×ÊÔ´Õ¼Óùý¸ßµÄÔµ¹ÊÔÓɼ°½â¾öÒªÁ죬²¢¸ø³öÏêϸµÄ´úÂëʾÀý¡£
Ò»¡¢Ôµ¹ÊÔÓÉÆÊÎö
Àú³ÌÕ¼ÓÃCPU¹ý¸ß£ºÓÐЩÀú³ÌÕ¼ÓÃCPU¹ý¸ß¿ÉÄܵ¼ÖÂϵͳ¸ºÔØÉý¸ß¡£Í¨¹ýÉó²éϵͳÀú³Ì¿ÉÒÔ¶¨Î»µ½ÏêϸÎÊÌâÀú³Ì¡£
ϵͳ¸ºÔعý¸ß£ºÏµÍ³¸ºÔعý¸ß¿ÉÄܵ¼ÖÂCPU×ÊÔ´±»¹ý¶àµÄʹÃüÕ¼Óá£Í¨¹ýÉó²éϵͳ¸ºÔØÇéÐοÉÒÔÆðÔ´ÅжÏÊDz»ÊÇϵͳ¸ºÔعý¸ß¡£
ϵͳÄÚºËÎÊÌ⣺LinuxϵͳÄں˵ÄÎÊÌâÒ²¿ÉÄܵ¼ÖÂCPU×ÊÔ´Õ¼Óùý¸ß¡£Í¨¹ýÉó²éÄÚºËÈÕÖ¾¿ÉÒÔÏàʶÊÇ·ñ±£´æÄÚºËÏà¹ØµÄÎÊÌâ¡£
¶þ¡¢½â¾öÒªÁ켰ʾÀý´úÂë
Éó²éϵͳ¸ºÔØÇéÐÎ
¿ÉÒÔʹÓÃÏÂÁîtopÀ´Éó²éϵͳ¸ºÔØÇéÐΣ¬ÀýÈ磺
top
µÇ¼ºó¸´ÖÆ
ÔÚtopÏÂÁîÖпÉÒÔÉó²éϵͳĿ½ñµÄ¸ºÔØÇéÐΡ¢CPUÕ¼ÓÃÇéÐÎÒÔ¼°Àú³ÌÐÅÏ¢£¬Æ¾Ö¤ÕâЩÐÅÏ¢¿ÉÒÔÆðÔ´ÅжÏÊÇÄÄЩÀú³Ìµ¼ÖÂÁËCPU×ÊÔ´Õ¼Óùý¸ß¡£
Éó²éÏêϸÀú³ÌÕ¼ÓÃCPU×ÊÔ´ÇéÐÎ
ʹÓÃpsÏÂÁî¿ÉÒÔÉó²éϵͳÖÐÕýÔÚÔËÐеÄÀú³Ì¼°ÆäCPUÕ¼ÓÃÇéÐΣ¬ÀýÈ磺
ps aux | grep <Àú³ÌÃû>
µÇ¼ºó¸´ÖÆ
ͨ¹ýÕâ¸öÏÂÁî¿ÉÒÔÉó²éµ½ÏêϸÊÇÄÄЩÀú³ÌÕ¼ÓÃÁËCPU×ÊÔ´£¬´Ó¶ø½øÒ»²½ÆÊÎöÎÊÌâËùÔÚ¡£
ʹÓÃtopÏÂÁî׼ʱ¼à¿Øϵͳ¸ºÔØ
¿ÉÒÔʹÓÃtopÏÂÁîÅäºÏcron׼ʱʹÃüÀ´¼à¿ØϵͳµÄ¸ºÔØÇéÐΣ¬ÀýÈçÿ5·ÖÖÓÖ´ÐÐÒ»´Îtop²¢½«Ð§¹ûдÈëÈÕÖ¾ÎļþÖУº
*/5 * * * * top -b -n 1 > /var/log/top-$(date +%Y%m%d-%H%M%S).log
µÇ¼ºó¸´ÖÆ
ͨ¹ý׼ʱ¼à¿Øϵͳ¸ºÔØÇéÐΣ¬¿ÉÒÔʵʱ·¢Ã÷ϵͳµÄ¸ºÔØÇéÐÎÊÇ·ñÕý³£¡£
¼ì²éϵͳÄÚºËÈÕÖ¾
¿ÉÒÔͨ¹ýÉó²éϵͳµÄÄÚºËÈÕÖ¾À´ÏàʶϵͳÄÚºËÊÇ·ñ±£´æÎÊÌ⣬ÀýÈ磺
dmesg | grep -i error
µÇ¼ºó¸´ÖÆ
ͨ¹ýÉó²éÄÚºËÈÕÖ¾ÖÐÊÇ·ñ±£´æerrorÒªº¦´Ê¿ÉÒÔ·¢Ã÷ϵͳÄÚºËÊÇ·ñ±£´æ¹ýʧ£¬½øÒ»²½ÆÊÎöÎÊÌâ²¢½â¾ö¡£
ͨ¹ýÒÔÉÏÒªÁì¶ÔLinuxϵͳÖÐCPU×ÊÔ´Õ¼Óùý¸ßÎÊÌâ¾ÙÐÐÆÊÎöÏ¢Õù¾ö£¬¿ÉÒÔ×ÊÖúÎÒÃÇʵʱ·¢Ã÷²¢½â¾öϵͳ×ÊÔ´Õ¼Óùý¸ßµÄÎÊÌ⣬°ü¹ÜϵͳµÄÕý³£ÔËÐкÍÎȹÌÐÔ¡£
Ï£ÍûÒÔÉÏÄÚÈݶÔÄúÓÐËù×ÊÖú¡£
ÒÔÉϾÍÊÇLinux CPUϵͳ×ÊÔ´Õ¼Óùý¸ßÎÊÌâÆÊÎöµÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡