{"id":223668,"date":"2021-08-01T08:33:08","date_gmt":"2021-08-01T00:33:08","guid":{"rendered":"https:\/\/lrxjmw.cn\/?p=223668"},"modified":"2021-08-16T08:35:05","modified_gmt":"2021-08-16T00:35:05","slug":"use-glances-monitor","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/use-glances-monitor.html","title":{"rendered":"\u5982\u4f55\u4f7f\u7528 Glances \u547d\u4ee4\u76d1\u63a7"},"content":{"rendered":"\n\n\n
\u5bfc\u8bfb<\/td>\nGlances \u662f\u57fa\u4e8e Python \u7684\u5f00\u6e90\u8de8\u5e73\u53f0\u7684\u547d\u4ee4\u884c\u76d1\u63a7\u5de5\u5177\uff0c\u53ef\u63d0\u4f9b\u6709\u5173\u7cfb\u7edf\u6027\u80fd\u7684\u5927\u91cf\u4fe1\u606f\u3002\u53ef\u4ee5\u76d1\u63a7\u5185\u5b58\u548c CPU \u5229\u7528\u7387\u3001\u7f51\u7edc\u5e26\u5bbd\u3001\u78c1\u76d8 I\/O\u3001\u6587\u4ef6\u7cfb\u7edf\u548c\u6b63\u5728\u8fd0\u884c\u7684\u8fdb\u7a0b\u7b49\u7b49\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n

Glances \u4ee5\u5177\u6709\u89c6\u89c9\u5438\u5f15\u529b\u7684\u683c\u5f0f\u663e\u793a\u4fe1\u606f\u3002\u6253\u5370\u51fa\u6709\u5173\u7684\u8be6\u7ec6\u4fe1\u606f\uff0c\u4f8b\u5982\uff1a<\/p>\n

\u7cfb\u7edf\u6b63\u5e38\u8fd0\u884c\u65f6\u95f4\u548cIP\u5730\u5740<\/p>\n

\u5185\u5b58\u5229\u7528\u7387<\/p>\n

CPU\u5229\u7528\u7387<\/p>\n

\u78c1\u76d8\u6302\u8f7d\u70b9<\/p>\n

\u78c1\u76d8 I\/O \u8bfb\u5199\u901f\u5ea6\u3002<\/p>\n

CPU\u5e73\u5747\u8d1f\u8f7d\u3001\u65e5\u671f\u548c\u65f6\u95f4<\/p>\n

\u6b63\u5728\u8fd0\u884c\u7684\u8fdb\u7a0b\u5305\u62ec\u6d3b\u52a8\u8fdb\u7a0b\u548c\u4f11\u7720\u8fdb\u7a0b\u3002<\/p>\n

\u7f51\u7edc\u5e26\u5bbd\uff08\u5305\u62ec\u4e0a\u4f20\u548c\u4e0b\u8f7d\u901f\u7387\uff09<\/p>\n

\u5982\u4f55\u5b89\u88c5Glances<\/strong><\/div>\n

\u9ed8\u8ba4\u60c5\u51b5\u4e0b\u4e0d\u5b89\u88c5 Glances\u3002\u4e0b\u9762\u4ecb\u7ecd\u5982\u4f55\u5728\u5e38\u7528\u7684linux\u53d1\u884c\u7248\u4e2d\u5b89\u88c5\uff1a<\/p>\n

\r\n# Ubuntu \/ Debian\r\n$ sudo apt install -y glances\r\n# CentOS\r\n[root@localhost ~]# yum -y install epel-release\r\n[root@localhost ~]# yum -y install glances\r\n<\/pre>\n

\u4e5f\u53ef\u4ee5\u4f7f\u7528snap\u5305\u7ba1\u7406\u5668\u6765\u5b89\u88c5glances\uff1a<\/p>\n

\r\n# snap install glances\r\n<\/pre>\n

\u6b64\u5916\uff0c\u7531\u4e8e Glances \u662f\u7528 Python \u7f16\u5199\u7684\uff0c\u56e0\u6b64\u4e5f\u53ef\u4ee5\u4f7f\u7528 pip \u5305\u7ba1\u7406\u5668\u6765\u5b89\u88c5\u5b83\uff1a<\/p>\n

\r\n# pip3 install glances\r\n<\/pre>\n
\u5728\u5355\u673a\u6a21\u5f0f\u4e0b\u76d1\u63a7\u7cfb\u7edf\u4fe1\u606f<\/strong><\/div>\n

\u542f\u52a8 Glances \u6765\u76d1\u63a7\u672c\u5730\u7cfb\u7edf\u662f\u4e00\u4ef6\u8f7b\u800c\u6613\u4e3e\u7684\u4e8b\u60c5\uff1a<\/p>\n

\r\n[root@localhost ~]# glances \r\n<\/pre>\n

\u53ef\u4ee5\u770b\u5230\u4e00\u4e9b\u7cfb\u7edf\u6307\u6807\uff0c\u4ece\u6700\u9876\u90e8\u7684\u4e3b\u673a\u540d\u5f00\u59cb\uff0c\u4ee5\u53ca\u4ece\u7ec8\u7aef\u53f3\u4e0a\u89d2\u7684\u6b63\u5e38\u8fd0\u884c\u65f6\u95f4\u5f00\u59cb\u3002\u5728\u5176\u4e0b\u65b9\uff0c\u60a8\u53ef\u4ee5\u67e5\u770b\u5176\u4ed6\u7cfb\u7edf\u6307\u6807\uff0c\u4f8b\u5982 CPU \u548c\u5185\u5b58\u5229\u7528\u7387\u3001\u7f51\u7edc\u5e26\u5bbd\u7387\u3001\u6b63\u5728\u8fd0\u884c\u7684\u8fdb\u7a0b\u3001\u78c1\u76d8\u5bb9\u91cf\u7b49\u3002
\n\"\"
\n\u5982\u679c\u8981\u5728 Web \u6d4f\u89c8\u5668\u4e2d\u67e5\u770b\u8fd9\u4e9b\u7edf\u8ba1\u4fe1\u606f\uff0c\u8bf7\u4f7f\u7528 -w \u9009\u9879\uff0c\u9700\u8981\u5148\u5b89\u88c5bottle\uff0c\u4e0d\u7136\u4f1a\u51fa\u73b0\u4e00\u4e0b\u9519\u8bef\uff1a<\/p>\n

\r\n[root@localhost ~]# glances -w\r\nBottle module not found. Glances cannot start in web server mode.\r\n<\/pre>\n

\u4e0b\u9762\u4f7f\u7528pip3\u5b89\u88c5bottle\uff1a<\/p>\n

\r\n[root@localhost ~]# pip3 install bottle\r\n<\/pre>\n

\u4e0b\u9762\u518d\u6b21\u6dfb\u52a0-w<\/code>\u9009\u9879\u542f\u52a8\uff1a<\/p>\n

\r\n[root@localhost ~]# glances -w\r\nGlances Web User Interface started on http:\/\/0.0.0.0:61208\/\r\n<\/pre>\n

\u7136\u540e\u5728\u6d4f\u89c8\u5668\u4e2d\u8f93\u5165\u670d\u52a1\u5668\u7684ip\u5730\u5740\uff0c\u7aef\u53e3\u4e3a\u4e0a\u9762\u8f93\u51fa\u4e2d\u63d0\u4f9b\u7684\u7aef\u53e361208<\/code>
\n\"\"
\n\u53ef\u4ee5\u901a\u8fc7\u914d\u7f6e\u5bc6\u7801\u4ee5\u4ec5\u5141\u8bb8\u5df2\u6388\u6743\u7528\u6237\u4f7f\u7528\u3002<\/p>\n

\r\n[root@localhost ~]# glances -w --password\r\nDefine the Glances webserver password (glances username): \r\nPassword (confirm): \r\nDo you want to save the password? [Yes\/No]: yes\r\nGlances Web User Interface started on http:\/\/0.0.0.0:61208\/\r\n<\/pre>\n

\u9ed8\u8ba4\u7684\u7528\u6237\u540d\u4e3a\uff1aglances
\n\"\"<\/p>\n

\u5728\u670d\u52a1\u5668\u6a21\u5f0f\u4e0b\u76d1\u63a7\u7cfb\u7edf\u4fe1\u606f<\/strong><\/div>\n

Glances \u547d\u4ee4\u4e5f\u53ef\u7528\u4e8e\u76d1\u63a7\u8fdc\u7a0b\u4e3b\u673a\u3002\u53ea\u9700\u6dfb\u52a0-s<\/code>\u9009\u9879\u5373\u53ef\u5728\u670d\u52a1\u5668\u6a21\u5f0f\u4e0b\u521d\u59cb\u5316 Glance\uff0c\u5982\u4e0b\u6240\u793a\u3002<\/p>\n

\r\n[root@localhost ~]# glances -s\r\nGlances XML-RPC server is running on 0.0.0.0:61209\r\n<\/pre>\n

\"\"
\n\u5728\u5ba2\u6237\u7aef PC \u4e2d\uff0c\u4f7f\u7528glances -c server-ip<\/code>\u5373\u53ef\u8fde\u63a5\uff1a<\/p>\n

\r\n[root@localhost ~]# glances -c 192.168.43.131\r\n<\/pre>\n

\"\"<\/p>\n

Glances \u8b66\u62a5\u7c7b\u578b<\/strong><\/div>\n

\u901a\u8fc7\u5728\u663e\u793a\u7cfb\u7edf\u6307\u6807\u65f6\u4f7f\u7528\u989c\u8272\u4ee3\u7801\uff0cGlances \u53ef\u4ee5\u66f4\u5bb9\u6613\u5730\u53d1\u73b0\u548c\u7f29\u5c0f\u95ee\u9898\u8303\u56f4\uff0c\u4e0b\u9762\u662f\u989c\u8272\u5bf9\u7528\u7684\u89e3\u91ca\uff1a<\/p>\n

    \n
  • GREEN<\/span>: OK (\u4e00\u5207\u6b63\u5e38)<\/li>\n
  • BLUE<\/span>: CAREFUL (\u9700\u8981\u6ce8\u610f)<\/li>\n
  • VIOLET<\/span>: WARNING (\u8b66\u544a)<\/li>\n
  • RED<\/span>: CRITICAL (\u4e25\u91cd\u9519\u8bef)<\/li>\n<\/ul>\n

    \u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0c\u9608\u503c\u53c2\u6570\u4e3a\uff1a<\/p>\n

      \n
    • careful=50<\/li>\n
    • warning=70<\/li>\n
    • critical=90<\/li>\n<\/ul>\n

      \u8fd9\u4e9b\u53c2\u6570\u53ef\u4ee5\u5728\/etc\/glances\/glances.conf<\/code>\u6587\u4ef6\u4e2d\u4fee\u6539\u3002<\/p>\n

      \u603b\u7ed3<\/strong><\/div>\n

      Glances \u662f\u4e00\u4e2a\u65b9\u4fbf\u7684\u5de5\u5177\uff0c\u5728\u66f4\u591a\u65b9\u9762\u611f\u89c9\u50cf\u662f top \u547d\u4ee4\u7684\u6539\u8fdb\u7248\u672c\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"

      Glances \u4ee5\u5177\u6709\u89c6\u89c9\u5438\u5f15\u529b\u7684\u683c\u5f0f\u663e\u793a\u4fe1\u606f\u3002\u6253\u5370\u51fa\u6709\u5173\u7684\u8be6\u7ec6\u4fe1\u606f\uff0c\u4f8b\u5982\uff1a \u7cfb\u7edf\u6b63\u5e38\u8fd0\u884c\u65f6\u95f4\u548cIP\u5730\u5740 \u5185\u5b58 […]<\/p>\n","protected":false},"author":309,"featured_media":223669,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-223668","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/223668","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/309"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=223668"}],"version-history":[{"count":1,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/223668\/revisions"}],"predecessor-version":[{"id":223675,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/223668\/revisions\/223675"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/223669"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=223668"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=223668"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=223668"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}