×ðÁú¿­Ê±¹ÙÍøµÇ¼

ÔõÑùÔÚLinuxÉÏÉèÖÃϵͳ¼à¿Ø

ÔõÑùÔÚlinuxÉÏÉèÖÃϵͳ¼à¿Ø

ÔÚLinux²Ù×÷ϵͳÉÏ  £¬ÏµÍ³¼à¿ØÊÇÒ»ÏîÖ÷ÒªµÄʹÃü¡£Í¨¹ý¼à¿Øϵͳ  £¬ÎÒÃÇ¿ÉÒÔ»ñµÃ¹ØÓÚϵͳÐÔÄÜ¡¢×ÊԴʹÓÃÇéÐΡ¢Ð§ÀÍÔËÐÐ״̬µÈ·½ÃæµÄÐÅÏ¢  £¬ÒÔ±ãʵʱ·¢Ã÷Ï¢Õù¾öÎÊÌâ¡£±¾ÎĽ«ÏÈÈÝÔõÑùÔÚlinuxÉÏÉèÖÃϵͳ¼à¿Ø  £¬²¢Ìṩ´úÂëʾÀý¡£

Ò»¡¢Ê¹ÓÃtopÏÂÁî¼à¿ØϵͳÐÔÄÜ

topÏÂÁîÊÇÒ»¸ö·Ç¾­³£ÓõÄϵͳ¼à¿Ø¹¤¾ß  £¬Ëü¿ÉÒÔʵʱÏÔʾϵͳµÄÔËÐÐ״̬ºÍÀú³ÌÐÅÏ¢¡£ÎÒÃÇ¿ÉÒÔͨ¹ýÒÔÏÂÏÂÁî×°ÖÃtopÏÂÁ

sudo apt-get install top

µÇ¼ºó¸´ÖÆ

×°ÖÃÍê³Éºó  £¬¿ÉÒÔÖ±½ÓÔÚÖÕ¶ËÔËÐÐtopÏÂÁîÀ´Éó²éϵͳµÄÔËÐÐ״̬¡£topÏÂÁîµÄÊä³öЧ¹û°üÀ¨ÏµÍ³¸ºÔØ¡¢CPUʹÓÃÂÊ¡¢ÄÚ´æʹÓÃÇéÐΡ¢Àú³ÌÁбíµÈ¡£

¶þ¡¢Ê¹ÓÃsarÏÂÁî¼Í¼ϵͳÐÔÄÜÊý¾Ý

sarÏÂÁîÊÇSystem Activity ReporterµÄËõд  £¬Ëü¿ÉÒԼͼϵͳÐÔÄÜÊý¾Ý  £¬²¢ÒÔÎı¾»ò¶þ½øÖÆÃûÌÃÉúÑÄ¡£ÎÒÃÇ¿ÉÒÔͨ¹ýÒÔÏÂÏÂÁî×°ÖÃsarÏÂÁ

sudo apt-get install sysstat

µÇ¼ºó¸´ÖÆ µÇ¼ºó¸´ÖÆ

×°ÖÃÍê³Éºó  £¬¿ÉÒÔʹÓÃÒÔÏÂÏÂÁîÀ´ÌìÉúϵͳÐÔÄÜÊý¾ÝµÄ±¨¸æ£º

sar -A > performance_report.txt

µÇ¼ºó¸´ÖÆ

¸ÃÏÂÁî»á½«ÏµÍ³µÄCPUʹÓÃÂÊ¡¢ÄÚ´æʹÓÃÂÊ¡¢´ÅÅÌIO¡¢ÍøÂç´«ÊäµÈÊý¾ÝÉúÑĵ½performance_report.txtÎļþÖС£

Èý¡¢Ê¹ÓÃnmonÏÂÁî¼à¿Øϵͳ×ÊÔ´

nmonÊÇÒ»¸ö¸ßЧµÄϵͳ¼à¿Ø¹¤¾ß  £¬Ëü¿ÉÒÔÏÔʾϵͳµÄCPUʹÓÃÂÊ¡¢ÄÚ´æʹÓÃÇéÐΡ¢´ÅÅÌIO¡¢ÍøÂç´«ÊäµÈÊý¾Ý¡£ÎÒÃÇ¿ÉÒÔͨ¹ýÒÔÏÂÏÂÁî×°ÖÃnmonÏÂÁ

sudo apt-get install nmon

µÇ¼ºó¸´ÖÆ

×°ÖÃÍê³Éºó  £¬¿ÉÒÔʹÓÃÒÔÏÂÏÂÁîÀ´Æô¶¯nmon£º

nmon

µÇ¼ºó¸´ÖÆ

nmonÏÂÁîÆô¶¯ºó  £¬»áÒÔ½»»¥Ê½½çÃæÏÔʾϵͳµÄ¸÷Ïî×ÊԴʹÓÃÇéÐΡ£¿ÉÒÔƾ֤ÌáÐѲÙ×÷  £¬Éó²é²î±ð×ÊÔ´µÄÏêϸÐÅÏ¢¡£

ËÄ¡¢Ê¹ÓÃsysstat¹¤¾ß¾ÙÐÐϵͳ¼à¿Ø

sysstatÊÇÒ»Ì×ϵͳÐÔÄܼà¿Ø¹¤¾ß  £¬ÆäÖаüÀ¨ÁËsar¡¢iostat¡¢mpstatµÈÏÂÁî¡£ÎÒÃÇ¿ÉÒÔͨ¹ýÒÔÏÂÏÂÁî×°ÖÃsysstat¹¤¾ß£º

sudo apt-get install sysstat

µÇ¼ºó¸´ÖÆ µÇ¼ºó¸´ÖÆ

×°ÖÃÍê³Éºó  £¬¿ÉÒÔʹÓÃÒÔÏÂÏÂÁîÀ´ÅÌÎÊϵͳÐÔÄÜÊý¾Ý£º

sar -u

µÇ¼ºó¸´ÖÆ

¸ÃÏÂÁî»áÏÔʾϵͳµÄCPUʹÓÃÇéÐΡ£¿ÉÒÔʹÓÃÆäËû²ÎÊýÀ´Éó²é²î±ð×ÊÔ´µÄÊý¾Ý  £¬ÀýÈçsar -rÉó²éÄÚ´æʹÓÃÇéÐÎ  £¬sar -n DEVÉó²éÍøÂç´«ÊäÇéÐεÈ¡£

Î塢ʹÓÃZabbix¾ÙÐÐÔ¶³Ì¼à¿Ø

ZabbixÊÇÒ»¸öÇ¿Ê¢µÄÍøÂç¼à¿Ø¹¤¾ß  £¬Ëü¿ÉÒÔʵʱ¼à¿Ø¶ą̀Ö÷»úµÄÐÔÄÜÊý¾Ý¡£ÎÒÃÇ¿ÉÒÔͨ¹ýÒÔÏÂÏÂÁî×°ÖÃZabbix Agent£º

sudo apt-get install zabbix-agent

µÇ¼ºó¸´ÖÆ

×°ÖÃÍê³Éºó  £¬ÐèÒª¾ÙÐÐһЩÉèÖÃÎļþµÄ±à¼­  £¬ÔÚzabbix_agentd.confÎļþÖÐÉèÖÃZabbix ServerµÄIPµØµãºÍ¶Ë¿ÚºÅ¡£È»ºóÖØÆôZabbix AgentЧÀÍ£º

sudo service zabbix-agent restart

µÇ¼ºó¸´ÖÆ

×îºó  £¬ÔÚZabbix ServerÉÏÉèÖüà¿ØÏîºÍ´¥·¢Æ÷  £¬¼´¿ÉʵÏÖÔ¶³Ì¼à¿Ø¡£

Áù¡¢Ê¹ÓÃPython±àд×Ô½ç˵¼à¿Ø¾ç±¾

³ýÁËʹÓÃÏÖÓеļà¿Ø¹¤¾ßÍâ  £¬ÎÒÃÇ»¹¿ÉÒÔʹÓÃPython±àд×Ô½ç˵µÄ¼à¿Ø¾ç±¾¡£ÒÔÏÂÊÇÒ»¸ö¼òÆÓµÄʾÀý  £¬¿ÉÒÔ¼ì²âϵͳµÄCPUʹÓÃÂÊ£º

import psutil

def get_cpu_usage():
    cpu_percent = psutil.cpu_percent()
    return cpu_percent

if __name__ == "__main__":
    cpu_usage = get_cpu_usage()
    print("CPU Usage: {}%".format(cpu_usage))

µÇ¼ºó¸´ÖÆ

ÉÏÊö´úÂëʹÓÃÁËpsutil¿âÀ´»ñȡϵͳµÄCPUʹÓÃÂÊ¡£¿ÉÒÔƾ֤ÐèÒª±àдÆäËû¹¦Ð§µÄ¼à¿Ø¾ç±¾  £¬ÀýÈç¼à¿ØÄÚ´æʹÓÃÇéÐΡ¢´ÅÅÌIO¡¢ÍøÂç´«ÊäµÈ¡£

×ܽ᣺

ÔÚLinux²Ù×÷ϵͳÉÏ  £¬¼à¿ØϵͳÊÇ°ü¹ÜϵͳÎȹ̺ÍÐÔÄÜÓÅ»¯µÄÖ÷ÒªÊֶΡ£±¾ÎÄÏÈÈÝÁ˼¸ÖÖ³£¼ûµÄϵͳ¼à¿ØÒªÁìºÍ¹¤¾ß  £¬°üÀ¨topÏÂÁî¡¢sarÏÂÁî¡¢nmonÏÂÁî¡¢sysstat¹¤¾ß¡¢ZabbixµÈ¡£±ðµÄ  £¬ÎÒÃÇ»¹¿ÉÒÔʹÓÃPython±àд×Ô½ç˵µÄ¼à¿Ø¾ç±¾  £¬ÒÔÖª×ãÌض¨ÐèÇó¡£Í¨¹ýʵʱ¼à¿Øϵͳ  £¬ÎÒÃÇ¿ÉÒÔÓÐÓ÷¢Ã÷ÎÊÌâ  £¬²¢½ÓÄÉÏìÓ¦µÄ²½·¥¾ÙÐд¦Àí  £¬°ü¹ÜϵͳµÄÕý³£ÔËÐС£

ÒÔÉϾÍÊÇÔõÑùÔÚLinuxÉÏÉèÖÃϵͳ¼à¿ØµÄÏêϸÄÚÈÝ  £¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡

ÃâÔð˵Ã÷£ºÒÔÉÏչʾÄÚÈÝȪԴÓÚÏàÖúýÌå¡¢ÆóÒµ»ú¹¹¡¢ÍøÓÑÌṩ»òÍøÂçÍøÂçÕûÀí  £¬°æȨÕùÒéÓë±¾Õ¾ÎÞ¹Ø  £¬ÎÄÕÂÉæ¼°¿´·¨Óë¿´·¨²»´ú±í×ðÁú¿­Ê±¹ÙÍøµÇ¼ÂËÓÍ»úÍø¹Ù·½Ì¬¶È  £¬Çë¶ÁÕß½ö×ö²Î¿¼¡£±¾ÎĽӴýתÔØ  £¬×ªÔØÇë˵Ã÷À´ÓÉ¡£ÈôÄúÒÔΪ±¾ÎÄÇÖÕ¼ÁËÄúµÄ°æȨÐÅÏ¢  £¬»òÄú·¢Ã÷¸ÃÄÚÈÝÓÐÈκÎÉæ¼°ÓÐÎ¥¹«µÂ¡¢Ã°·¸Ö´·¨µÈÎ¥·¨ÐÅÏ¢  £¬ÇëÄúÁ¬Ã¦ÁªÏµ×ðÁú¿­Ê±¹ÙÍøµÇ¼ʵʱÐÞÕý»òɾ³ý¡£

Ïà¹ØÐÂÎÅ

ÁªÏµ×ðÁú¿­Ê±¹ÙÍøµÇ¼

18523999891

¿É΢ÐÅÔÚÏß×Éѯ

ÊÂÇéʱ¼ä£ºÖÜÒ»ÖÁÖÜÎå  £¬9:30-18:30  £¬½ÚãåÈÕÐÝÏ¢

QR code
ÍøÕ¾µØͼ