{"id":19370,"date":"2022-10-28T17:30:26","date_gmt":"2022-10-28T09:30:26","guid":{"rendered":"http:\/\/gulass.cn\/?p=19370"},"modified":"2022-10-28T17:30:38","modified_gmt":"2022-10-28T09:30:38","slug":"monitorin-system-ubuntu","status":"publish","type":"post","link":"https:\/\/gulass.cn\/monitorin-system-ubuntu.html","title":{"rendered":"\u5982\u4f55\u5728Ubuntu\u4e0a\u4f7f\u7528Glances\u76d1\u63a7\u7cfb\u7edf"},"content":{"rendered":"\n\n\n
\u5bfc\u8bfb<\/td>\n\u00a0Glances \u662f\u4e00\u4e2a\u7528\u4e8e\u76d1\u63a7\u7cfb\u7edf\u7684\u8de8\u5e73\u53f0\u3001\u57fa\u4e8e\u6587\u672c\u6a21\u5f0f\u7684\u547d\u4ee4\u884c\u5de5\u5177\u3002\u5b83\u662f\u7528 Python \u7f16\u5199\u7684\uff0c\u4f7f\u7528 psutil \u5e93\u4ece\u7cfb\u7edf\u83b7\u53d6\u4fe1\u606f\u3002\u4f60\u53ef\u4ee5\u7528\u5b83\u6765\u76d1\u63a7 CPU\u3001\u5e73\u5747\u8d1f\u8f7d\u3001\u5185\u5b58\u3001\u7f51\u7edc\u63a5\u53e3\u3001\u78c1\u76d8 I\/O\uff0c\u6587\u4ef6\u7cfb\u7edf\u7a7a\u95f4\u5229\u7528\u7387\u3001\u6302\u8f7d\u7684\u8bbe\u5907\u3001\u6240\u6709\u6d3b\u52a8\u8fdb\u7a0b\u4ee5\u53ca\u6d88\u8017\u8d44\u6e90\u6700\u591a\u7684\u8fdb\u7a0b\u3002Glances \u6709\u5f88\u591a\u6709\u8da3\u7684\u9009\u9879\u3002\u5b83\u7684\u4e3b\u8981\u7279\u6027\u4e4b\u4e00\u662f\u53ef\u4ee5\u5728\u914d\u7f6e\u6587\u4ef6\u4e2d\u8bbe\u7f6e\u9600\u503c(careful\u5c0f\u5fc3\u3001warning\u8b66\u544a\u3001critical\u81f4\u547d)\uff0c\u7136\u540e\u5b83\u4f1a\u7528\u4e0d\u540c\u989c\u8272\u663e\u793a\u4fe1\u606f\u4ee5\u8868\u660e\u7cfb\u7edf\u7684\u74f6\u9888\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n

\"jiankong\"<\/p>\n

Glances \u7684\u529f\u80fd<\/strong><\/div>\n

\u25c6CPU \u5e73\u5747\u8d1f\u8f7d<\/p>\n

\u25c6\u4e0d\u540c\u72b6\u6001(\u5982\u6d3b\u52a8\u3001\u4f11\u7720)\u8fdb\u7a0b\u7684\u6570\u91cf<\/p>\n

\u25c6\u6240\u6709\u5185\u5b58\u4fe1\u606f\uff0c\u5982\u7269\u7406\u5185\u5b58\u3001\u4ea4\u6362\u7a7a\u95f4\u3001\u7a7a\u95f2\u5185\u5b58<\/p>\n

\u25c6CPU \u4fe1\u606f<\/p>\n

\u25c6\u7f51\u7edc\u8fde\u63a5\u7684\u4e0a\u884c\/\u4e0b\u884c\u901f\u5ea6<\/p>\n

\u25c6\u78c1\u76d8 I\/O \u8bfb\/\u5199\u901f\u5ea6\u8be6\u7ec6\u4fe1\u606f<\/p>\n

\u25c6\u5f53\u524d\u6302\u8f7d\u8bbe\u5907\u7684\u78c1\u76d8\u4f7f\u7528\u60c5\u51b5<\/p>\n

\u25c6\u6d88\u8017\u8d44\u6e90\u6700\u591a\u7684\u8fdb\u7a0b\u548c\u4ed6\u4eec\u7684 CPU\/\u5185\u5b58\u4f7f\u7528\u60c5\u51b5<\/p>\n

\u5b89\u88c5 Glances<\/strong><\/div>\n

Glances \u5728 Ubuntu \u7684\u8f6f\u4ef6\u4ed3\u5e93\u4e2d\uff0c\u6240\u4ee5\u5b89\u88c5\u5f88\u7b80\u5355\u3002\u6267\u884c\u4e0b\u9762\u7684\u547d\u4ee4\u5b89\u88c5 Glances\uff1a<\/p>\n

sudo\u00a0apt-get\u00a0install\u00a0glances<\/pre>\n

\u82e5\u5b89\u88c5\u540e\u65e0\u6cd5\u6b63\u5e38\u4f7f\u7528\uff0c\u53ef\u8003\u8651\u4f7f\u7528 pip \u5b89\u88c5\/\u5347\u7ea7 glances\uff1a<\/p>\n

sudo\u00a0pip\u00a0install\u00a0--upgrade\u00a0glances<\/pre>\n
Glances \u4f7f\u7528\u65b9\u6cd5<\/strong><\/div>\n

\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u53ef\u4ee5\u6267\u884c\u4e0b\u9762\u7684\u547d\u4ee4\u542f\u52a8 Glances\uff1a<\/p>\n

glances<\/pre>\n

\u4f60\u5c06\u770b\u5230\u7c7b\u4f3c\u4e0b\u56fe\u7684\u8f93\u51fa\uff1a<\/p>\n

\"jiankong-88\"<\/p>\n

glances monitor system output<\/p>\n

\u8981\u9000\u51fa Glances \u7ec8\u7aef\uff0c\u6309 ESC \u952e\u6216 Ctrl + C\u3002<\/p>\n

\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u65f6\u95f4\u95f4\u9694(\u663e\u793a\u6570\u636e\u5237\u65b0\u7684\u65f6\u95f4\u95f4\u9694)\u662f 1 \u79d2\uff0c\u4e0d\u8fc7\u4f60\u53ef\u4ee5\u5728\u4ece\u7ec8\u7aef\u542f\u52a8 Glances \u65f6\u81ea\u5b9a\u4e49\u65f6\u95f4\u95f4\u9694\u3002<\/p>\n

\u8981\u628a\u65f6\u95f4\u95f4\u9694\u8bbe\u4e3a 5 \u79d2\uff0c\u6267\u884c\u4e0b\u9762\u7684\u547d\u4ee4\uff1a<\/p>\n

glances\u00a0-t\u00a05<\/pre>\n
Glances \u4e2d\u4e0d\u540c\u989c\u8272\u7684\u542b\u4e49\uff1a<\/strong><\/div>\n

\u25c6\u7eff\u8272\uff1a\u6b63\u5e38(OK)<\/p>\n

\u25c6\u84dd\u8272\uff1a\u5c0f\u5fc3(careful)<\/p>\n

\u25c6\u7d2b\u8272\uff1a\u8b66\u544a(warning)<\/p>\n

\u25c6\u7ea2\u8272\uff1a\u81f4\u547d(critical)<\/p>\n

\u9ed8\u8ba4\u8bbe\u7f6e\u4e0b\uff0cGlances \u7684\u9600\u503c\u8bbe\u7f6e\u662f\uff1acareful=50\uff0cwarning=70\uff0ccritical=90\u3002\u4f60\u53ef\u4ee5\u901a\u8fc7 \u201c\/etc\/glances\/\u201d \u76ee\u5f55\u4e0b\u7684\u9ed8\u8ba4\u914d\u7f6e\u6587\u4ef6 glances.conf \u6765\u81ea\u5b9a\u4e49\u8fd9\u4e9b\u9600\u503c\u3002<\/p>\n

Glances \u7684\u9009\u9879<\/strong><\/div>\n

 <\/p>\n

Glances \u63d0\u4f9b\u4e86\u5f88\u591a\u5feb\u6377\u952e\uff0c\u53ef\u4ee5\u5728\u5b83\u8fd0\u884c\u65f6\uff0c\u7528\u6765\u67e5\u627e\u8f93\u51fa\u4fe1\u606f\u3002<\/p>\n

\u4e0b\u9762\u662f\u4e00\u4e9b\u5e38\u7528\u7684\u70ed\u952e\u5217\u8868\uff1a<\/p>\n

\u25c6m\uff1a\u6309\u5185\u5b58\u5360\u7528\u6392\u5e8f\u8fdb\u7a0b<\/p>\n

\u25c6p\uff1a\u6309\u8fdb\u7a0b\u540d\u79f0\u6392\u5e8f\u8fdb\u7a0b<\/p>\n

\u25c6c\uff1a\u6309 CPU \u5360\u7528\u7387\u6392\u5e8f\u8fdb\u7a0b<\/p>\n

\u25c6i\uff1a\u6309 I\/O \u9891\u7387\u6392\u5e8f\u8fdb\u7a0b<\/p>\n

\u25c6a\uff1a\u81ea\u52a8\u6392\u5e8f\u8fdb\u7a0b<\/p>\n

\u25c6d\uff1a\u663e\u793a\/\u9690\u85cf\u78c1\u76d8 I\/O \u7edf\u8ba1\u4fe1\u606f<\/p>\n

\u25c6f\uff1a\u663e\u793a\/\u9690\u85cf\u6587\u4ef6\u7cfb\u7edf\u7edf\u8ba1\u4fe1\u606f<\/p>\n

\u25c6s\uff1a\u663e\u793a\/\u9690\u85cf\u4f20\u611f\u5668\u7edf\u8ba1\u4fe1\u606f<\/p>\n

\u25c6y\uff1a\u663e\u793a\/\u9690\u85cf\u786c\u76d8\u6e29\u5ea6\u7edf\u8ba1\u4fe1\u606f<\/p>\n

\u25c6l\uff1a\u663e\u793a\/\u9690\u85cf\u65e5\u5fd7<\/p>\n

\u25c6n\uff1a\u663e\u793a\/\u9690\u85cf\u7f51\u7edc\u7edf\u8ba1\u4fe1\u606f<\/p>\n

\u25c6x\uff1a\u5220\u9664\u8b66\u544a\u548c\u4e25\u91cd\u65e5\u5fd7<\/p>\n

\u25c6h\uff1a\u663e\u793a\/\u9690\u85cf\u5e2e\u52a9\u754c\u9762<\/p>\n

\u25c6q\uff1a\u9000\u51fa<\/p>\n

\u25c6w\uff1a\u5220\u9664\u8b66\u544a\u8bb0\u5f55<\/p>\n

\u4f7f\u7528 Glances \u76d1\u63a7\u8fdc\u7a0b\u7cfb\u7edf<\/strong><\/div>\n

\u4f60\u4e5f\u53ef\u4ee5\u4f7f\u7528 Glances \u76d1\u63a7\u8fdc\u7a0b\u7cfb\u7edf\u3002\u8981\u5728\u8fdc\u7a0b\u7cfb\u7edf\u4e0a\u4f7f\u7528\u5b83\uff0c\u4f7f\u7528\u4e0b\u9762\u7684\u547d\u4ee4\uff1a<\/p>\n

glances\u00a0-s<\/pre>\n

\u4f60\u4f1a\u770b\u5230\u7c7b\u4f3c\u4e0b\u9762\u7684\u8f93\u51fa\uff1a<\/p>\n

\"\u5982\u4f55\u5728Ubuntu\u4e0a\u4f7f\u7528Glances\u76d1\u63a7\u7cfb\u7edf\"<\/p>\n

glances monitor remote system server<\/p>\n

\u5982\u4f60\u6240\u89c1\uff0cGlances \u8fd0\u884c\u5728 61209 \u7aef\u53e3\u3002<\/p>\n

\u73b0\u5728\uff0c\u5230\u8fdc\u7a0b\u673a\u5668\u4e0a\u6267\u884c\u4e0b\u9762\u7684\u547d\u4ee4\u4ee5\u8fde\u63a5\u5230\u6307\u5b9a IP \u5730\u5740\u7684 Glances \u670d\u52a1\u5668\u4e0a\u3002\u5047\u8bbe 192.168.1.10 \u662f\u4f60\u7684 Glances \u670d\u52a1\u5668 IP \u5730\u5740\u3002<\/p>\n

glances\u00a0-c\u00a0-P\u00a0192.168.1.10<\/pre>\n

\u7ed3\u8bba<\/strong><\/p>\n

\u5bf9\u4e8e\u6bcf\u4e2a Linux \u7cfb\u7edf\u7ba1\u7406\u5458\u6765\u8bf4\uff0cGlances \u90fd\u662f\u4e00\u4e2a\u975e\u5e38\u6709\u7528\u7684\u5de5\u5177\u3002\u4f7f\u7528\u5b83\uff0c\u4f60\u53ef\u4ee5\u8f7b\u677e\u3001\u9ad8\u6548\u5730\u76d1\u63a7 Linux \u7cfb\u7edf\u3002\u5982\u679c\u4f60\u6709\u4ec0\u4e48\u95ee\u9898\uff0c\u81ea\u7531\u5730\u8bc4\u8bba\u5427\uff01<\/p>\n

\n

\u539f\u6587\u6765\u81ea\uff1ahttp:\/\/os.51cto.com\/art\/201601\/504029.htm<\/a><\/p>\n

\u672c\u6587\u5730\u5740\uff1ahttp:\/\/gulass.cn\/monitorin-system-ubuntu.html<\/a>\u7f16\u8f91\uff1a51CTO\uff0c\u5ba1\u6838\u5458\uff1a\u51af\u742a<\/span><\/p>\n<\/blockquote>\n","protected":false},"excerpt":{"rendered":"

     Glances \u662f\u4e00\u4e2a\u7528\u4e8e\u76d1\u63a7\u7cfb\u7edf\u7684\u8de8\u5e73\u53f0\u3001\u57fa\u4e8e\u6587\u672c\u6a21\u5f0f\u7684\u547d\u4ee4\u884c\u5de5\u5177\u3002\u5b83\u662f\u7528 Python \u7f16\u5199\u7684\uff0c\u4f7f\u7528 psutil \u5e93\u4ece\u7cfb\u7edf\u83b7\u53d6\u4fe1\u606f\u3002\u4f60\u53ef\u4ee5\u7528\u5b83\u6765\u76d1\u63a7 CPU\u3001\u5e73\u5747\u8d1f\u8f7d\u3001\u5185\u5b58\u3001\u7f51\u7edc\u63a5\u53e3\u3001\u78c1\u76d8 I\/O\uff0c\u6587\u4ef6\u7cfb\u7edf\u7a7a\u95f4\u5229\u7528\u7387\u3001\u6302\u8f7d\u7684\u8bbe\u5907\u3001\u6240\u6709\u6d3b\u52a8\u8fdb\u7a0b\u4ee5\u53ca\u6d88\u8017\u8d44\u6e90\u6700\u591a\u7684\u8fdb\u7a0b\u3002Glances \u6709\u5f88\u591a\u6709\u8da3\u7684\u9009\u9879\u3002\u5b83\u7684\u4e3b\u8981\u7279\u6027\u4e4b\u4e00\u662f\u53ef\u4ee5\u5728\u914d\u7f6e\u6587\u4ef6\u4e2d\u8bbe\u7f6e\u9600\u503c(careful\u5c0f\u5fc3\u3001warning\u8b66\u544a\u3001critical\u81f4\u547d)\uff0c\u7136\u540e\u5b83\u4f1a\u7528\u4e0d\u540c\u989c\u8272\u663e\u793a\u4fe1\u606f\u4ee5\u8868\u660e\u7cfb\u7edf\u7684\u74f6\u9888\u3002<\/p>\n","protected":false},"author":63,"featured_media":20509,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-19370","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts\/19370","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/users\/63"}],"replies":[{"embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/comments?post=19370"}],"version-history":[{"count":9,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts\/19370\/revisions"}],"predecessor-version":[{"id":256324,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts\/19370\/revisions\/256324"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/media\/20509"}],"wp:attachment":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/media?parent=19370"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/categories?post=19370"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/tags?post=19370"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}