{"id":94075,"date":"2024-04-24T22:50:11","date_gmt":"2024-04-24T14:50:11","guid":{"rendered":"http:\/\/lrxjmw.cn\/?p=94075"},"modified":"2024-04-24T22:50:11","modified_gmt":"2024-04-24T14:50:11","slug":"python-nmon","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/python-nmon.html","title":{"rendered":"\u795e\u5668Nmon"},"content":{"rendered":"\n\n\n
\u5bfc\u8bfb<\/td>\nNigel's monitor\uff0c\u4e5f\u53eb\u505a \u201cNmon\u201d\uff0c\u662f\u4e00\u4e2a\u5f88\u597d\u7684\u76d1\u63a7\u3001\u8bb0\u5f55\u548c\u5206\u6790 Linux\/*nix \u7cfb\u7edf\u6027\u80fd\u968f\u65f6\u95f4\u53d8\u5316\u7684\u5de5\u5177\u3002Nmon \u6700\u521d\u7531 IBM \u5f00\u53d1\u5e76\u4e8e 2009 \u5e74\u590f\u5929\u5f00\u6e90\u3002\u65f6\u81f3\u4eca\u65e5 Nmon \u5df2\u7ecf\u5728\u6240\u6709 Linux \u5e73\u53f0\u548c\u67b6\u6784\u4e0a\u90fd\u53ef\u7528\u4e86\u3002\u5b83\u63d0\u4f9b\u4e86\u5f88\u68d2\u7684\u5f53\u524d\u7cfb\u7edf\u7edf\u8ba1\u4fe1\u606f\u7684\u57fa\u4e8e\u547d\u4ee4\u884c\u7684\u5b9e\u65f6\u53ef\u89c6\u5316\u62a5\u544a\uff0c\u8fd9\u4e9b\u7edf\u8ba1\u4fe1\u606f\u5305\u62ec CPU\u3001RAM\u3001\u7f51\u7edc\u548c\u78c1\u76d8 I\/O\u3002\u7136\u800c\uff0cNmon \u6700\u68d2\u7684\u7279\u6027\u662f\u53ef\u4ee5\u968f\u7740\u65f6\u95f4\u7684\u63a8\u79fb\u8bb0\u5f55\u7cfb\u7edf\u6027\u80fd\u5feb\u7167\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n

\"\"<\/p>\n

\u6bd4\u5982\uff1anmon -f -s 1\u3002<\/p>\n

\"\"<\/p>\n

nmon CPU and Disk utilization<\/em><\/p>\n

\u4f1a\u521b\u5efa\u4e00\u4e2a\u65e5\u5fd7\u6587\u4ef6\uff0c\u8be5\u65e5\u5fd7\u6587\u4ef6\u6700\u5f00\u5934\u662f\u4e00\u4e9b\u7cfb\u7edf\u7684\u5143\u6570\u636e\uff08AAA - BBBV \u90e8\u5206\uff09\uff0c\u540e\u9762\u662f\u6240\u76d1\u63a7\u7684\u7cfb\u7edf\u5c5e\u6027\u7684\u5b9a\u65f6\u5feb\u7167\uff0c\u6bd4\u5982 CPU \u548c\u5185\u5b58\u7684\u4f7f\u7528\u60c5\u51b5\u3002\u8fd9\u4e2a\u8f93\u51fa\u7684\u6587\u4ef6\u5f88\u96be\u76f4\u63a5\u7531\u7535\u5b50\u8868\u683c\u5e94\u7528\u6765\u5904\u7406\uff0c\u56e0\u6b64\u8bde\u751f\u4e86Nmon_Analyzer excel \u5b8f\u3002\u5982\u679c\u4f60\u7528\u7684\u662f Windows\/Mac \u5e76\u5b89\u88c5\u4e86 Microsoft Office\uff0c\u90a3\u4e48\u8fd9\u4e2a\u5de5\u5177\u975e\u5e38\u4e0d\u9519\u3002\u5982\u679c\u6ca1\u6709\u8fd9\u4e2a\u73af\u5883\u90a3\u4e5f\u53ef\u4ee5\u4f7f\u7528 Nmon2rrd \u5de5\u5177\uff0c\u8fd9\u4e2a\u5de5\u5177\u80fd\u5c06\u65e5\u5fd7\u6587\u4ef6\u8f6c\u6362 RRD \u8f93\u5165\u6587\u4ef6\uff0c\u8fdb\u800c\u751f\u6210\u56fe\u5f62\u3002\u8fd9\u4e2a\u8fc7\u7a0b\u5f88\u6b7b\u677f\u800c\u4e14\u6709\u70b9\u9ebb\u70e6\u3002\u73b0\u5728\u51fa\u73b0\u4e86\u4e00\u4e2a\u66f4\u7075\u6d3b\u7684\u5de5\u5177\uff0c\u6211\u5411\u4f60\u4eec\u4ecb\u7ecd\u4e00\u4e0b pyNmonAnalyzer\uff0c\u5b83\u63d0\u4f9b\u4e86\u4e00\u4e2a\u53ef\u5b9a\u5236\u5316\u7684\u89e3\u51b3\u65b9\u6848\u6765\u751f\u6210\u7ed3\u6784\u5316\u7684 CSV \u6587\u4ef6\u548c\u5e26\u6709\u7528 matplotlib \u751f\u6210\u7684\u56fe\u7247\u7684\u7b80\u5355 HTML \u62a5\u544a\u3002<\/p>\n

\u5165\u95e8\u4ecb\u7ecd<\/strong><\/div>\n

\u7cfb\u7edf\u9700\u6c42\uff1a<\/p>\n

\u4ece\u540d\u5b57\u4e2d\u5c31\u80fd\u770b\u51fa\u6211\u4eec\u9700\u8981\u6709 python\u3002\u6b64\u5916 pyNmonAnalyzer \u8fd8\u4f9d\u8d56\u4e8e matplotlib \u548c numpy\u3002\u82e5\u4f60\u4f7f\u7528\u7684\u662f debian \u884d\u751f\u7684\u7cfb\u7edf\uff0c\u5219\u4f60\u9700\u8981\u5148\u5b89\u88c5\u8fd9\u4e9b\u5305\uff1a<\/p>\n

$ sudo apt-get install python-numpy python-matplotlib<\/pre>\n
\u83b7\u53d6 pyNmonAnalyzer\uff1a<\/strong><\/span><\/div>\n

\u4f60\u53ef\u4ee5\u514b\u9686 git \u4ed3\u5e93\uff1a<\/p>\n

$ git clone git@github.com:madmaze\/pyNmonAnalyzer.git<\/pre>\n

\u6216\u8005\uff0c\u76f4\u63a5\u4ece\u8fd9\u91cc\u4e0b\u8f7d\uff1apyNmonAnalyzer-1.0.zip \u3002(LCTT \u8bd1\u6ce8\uff1a\u8fd9\u662f\u4e2a 5 \u5e74\u524d\u7684\u9879\u76ee\u4f46\u662f\u4e00\u76f4\u5728\u9646\u9646\u7eed\u7eed\u7684\u8fdb\u884c\u7ef4\u62a4\uff09<\/p>\n

\u63a5\u4e0b\u6765\u6211\u4eec\u9700\u8981\u4e00\u4e2a Nmon \u6587\u4ef6\uff0c\u5982\u679c\u6ca1\u6709\u7684\u8bdd\uff0c\u53ef\u4ee5\u4f7f\u7528\u53d1\u884c\u7248\u4e2d\u63d0\u4f9b\u7684\u5b9e\u4f8b\u6216\u8005\u81ea\u5df1\u5f55\u5236\u4e00\u4e2a\u6837\u672c\uff1anmon -F test.nmon -s 1 -c 120\uff0c\u4f1a\u5f55\u5236 120 \u4e2a\u5feb\u7167\uff0c\u6bcf\u79d2\u4e00\u4e2a\uff0c\u5b58\u50a8\u5230 test.nmon \u6587\u4ef6\u4e2d\u3002<\/p>\n

\u8ba9\u6211\u4eec\u6765\u770b\u770b\u57fa\u672c\u7684\u5e2e\u52a9\u4fe1\u606f\uff1a<\/p>\n

$ .\/pyNmonAnalyzer.py -h\r\nusage: pyNmonAnalyzer.py [-h] [-x] [-d] [-o OUTDIR] [-c] [-b] [-r CONFFNAME]\r\n input_file\r\nnmonParser converts Nmon monitor files into time-sorted\r\nCSV\/Spreadsheets for easier analysis, without the use of the\r\nMS Excel Macro. Also included is an option to build an HTML\r\nreport with graphs, which is configured through report.config.\r\npositional arguments:\r\n input_file Input NMON file\r\noptional arguments:\r\n -h, --help show this help message and exit\r\n -x, --overwrite overwrite existing results (Default: False)\r\n -d, --debug debug? (Default: False)\r\n -o OUTDIR, --output OUTDIR\r\n Output dir for CSV (Default: .\/data\/)\r\n -c, --csv CSV output? (Default: False)\r\n -b, --buildReport report output? (Default: False)\r\n -r CONFFNAME, --reportConfig CONFFNAME\r\n Report config file, if none exists: we will write the\r\n default config file out (Default: .\/report.config)\r\n<\/pre>\n

\u8be5\u5de5\u5177\u6709\u4e24\u4e2a\u4e3b\u8981\u7684\u9009\u9879<\/p>\n

    \n
  1. \u5c06 nmon \u6587\u4ef6\u4f20\u5524\u6210\u4e00\u7cfb\u5217\u72ec\u7acb\u7684 CSV \u6587\u4ef6<\/li>\n
  2. \u4f7f\u7528 matplotlib \u751f\u6210\u5e26\u56fe\u5f62\u7684 HTML \u62a5\u544a<\/li>\n<\/ol>\n

    \u4e0b\u9762\u547d\u4ee4\u65e2\u4f1a\u751f\u6210 CSV \u6587\u4ef6\uff0c\u4e5f\u4f1a\u751f\u6210 HTML \u62a5\u544a\uff1a<\/p>\n

    $ .\/pyNmonAnalyzer.py -c -b test.nmon<\/pre>\n

    \u8fd9\u4f1a\u521b\u5efa\u4e00\u4e2a .\/data \u76ee\u5f55\uff0c\u5176\u4e2d\u6709\u4e00\u4e2a\u5b58\u653e CSV \u6587\u4ef6\u7684\u76ee\u5f55 (.\/data\/csv\/)\uff0c\u4e00\u4e2a\u5b58\u653e PNG \u56fe\u7247\u7684\u76ee\u5f55 (.\/data\/img\/) \u4ee5\u53ca\u4e00\u4e2a HTML \u62a5\u544a (.\/data\/report.html)\u3002<\/p>\n

    \u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0cHTML \u62a5\u544a\u4e2d\u4f1a\u7528\u56fe\u7247\u5c55\u793a CPU\u3001\u78c1\u76d8\u7e41\u5fd9\u7a0b\u5ea6\u3001\u5185\u5b58\u4f7f\u7528\u60c5\u51b5\u548c\u7f51\u7edc\u4f20\u8f93\u60c5\u51b5\u3002\u6240\u6709\u8fd9\u4e9b\u90fd\u5b9a\u4e49\u5728\u4e00\u4e2a\u4e0d\u8a00\u81ea\u660e\u7684\u914d\u7f6e\u6587\u4ef6\u4e2d (report.config)\u3002\u76ee\u524d\u8fd9\u4e2a\u5de5\u5177\u8fd8\u4e0d\u662f\u7279\u522b\u7684\u7075\u6d3b\uff0c\u56e0\u4e3a CPU \u548c MEM \u9664\u4e86on \u548c off \u5916\uff0c\u65e0\u6cd5\u505a\u5176\u4ed6\u7684\u914d\u7f6e\u3002\u4e0d\u8fc7\u4e0b\u4e00\u6b65\u5c06\u4f1a\u6539\u8fdb\u4f5c\u56fe\u7684\u65b9\u6cd5\u5e76\u5141\u8bb8\u7528\u6237\u7075\u6d3b\u5730\u6307\u5b9a\u9488\u5bf9\u54ea\u4e9b\u6570\u636e\u4f7f\u7528\u54ea\u79cd\u4f5c\u56fe\u65b9\u6cd5\u3002<\/p>\n

    \u76ee\u524d\u8fd9\u4e9b\u62a5\u544a\u8fd8\u5341\u5206\u7684\u67af\u71e5\u800c\u4e14\u53ea\u80fd\u6253\u5370\u51fa\u57fa\u672c\u7684\u51e0\u79cd\u6807\u8bb0\u56fe\u8868\uff0c\u4e0d\u8fc7\u5b83\u7684\u529f\u80fd\u8fd8\u5728\u4e0d\u65ad\u7684\u5b8c\u5584\u4e2d\u3002\u76ee\u524d\u5728\u5f00\u53d1\u7684\u662f\u4e00\u4e2a\u5411\u5bfc\u6765\u8ba9\u914d\u7f6e\u8c03\u6574\u53d8\u5f97\u66f4\u5bb9\u6613\u3002\u5982\u679c\u6709\u4efb\u4f55\u5efa\u8bae\uff0c\u627e\u5230\u4efb\u4f55 bug \u6216\u8005\u6709\u4efb\u4f55\u529f\u80fd\u9700\u6c42\uff0c\u6b22\u8fce\u4e0e\u6211\u4ea4\u6d41\u3002<\/p>\n


    \n

    via: https:\/\/matthiaslee.com\/python-nmon-analyzer-moving-away-from-excel-macros\/<\/a><\/p>\n

    \u4f5c\u8005\uff1aMatthias Lee<\/a> \u8bd1\u8005\uff1alujun9972<\/a> \u6821\u5bf9\uff1awxy<\/a><\/p>\n

    \u672c\u6587\u7531 LCTT<\/a> \u539f\u521b\u7f16\u8bd1\uff0cLinux\u4e2d\u56fd<\/a> \u8363\u8a89\u63a8\u51fa<\/p>\n

    \n

    \u539f\u6587\u6765\u81ea\uff1ahttps:\/\/linux.cn\/article-9294-1.html<\/a><\/p>\n

    \u672c\u6587\u5730\u5740\uff1a http:\/\/lrxjmw.cn\/python-nmon.html<\/a>\u7f16\u8f91\uff1a\u674e\u5e05\uff0c\u5ba1\u6838\u5458\uff1a\u9004\u589e\u5b9d<\/span><\/p>\n<\/blockquote>\n","protected":false},"excerpt":{"rendered":"

    \u5bfc\u8bfb Nigel’s monitor\uff0c\u4e5f\u53eb\u505a \u201cNmon\u201d\uff0c\u662f\u4e00\u4e2a\u5f88\u597d\u7684\u76d1\u63a7\u3001\u8bb0\u5f55\u548c\u5206\u6790 Linux\/*nix […]<\/p>\n","protected":false},"author":63,"featured_media":94092,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-94075","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\/94075","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\/63"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=94075"}],"version-history":[{"count":8,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/94075\/revisions"}],"predecessor-version":[{"id":291092,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/94075\/revisions\/291092"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/94092"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=94075"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=94075"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=94075"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}