{"id":11314,"date":"2022-12-28T10:01:40","date_gmt":"2022-12-28T02:01:40","guid":{"rendered":"https:\/\/www.lwops.cn\/?p=11314"},"modified":"2022-12-28T10:01:40","modified_gmt":"2022-12-28T02:01:40","slug":"prometheus%e6%8a%80%e6%9c%af%e5%88%86%e4%ba%ab-prometheus%e7%9a%84%e5%87%bd%e6%95%b0%e4%b8%8e%e8%ae%a1%e7%ae%97%e5%85%ac%e5%bc%8f%e8%af%a6%e8%a7%a3","status":"publish","type":"post","link":"https:\/\/www.lwops.cn\/index.php\/prometheus\/prometheus-artisan\/11314","title":{"rendered":"Prometheus\u6280\u672f\u5206\u4eab\u2014\u2014prometheus\u7684\u51fd\u6570\u4e0e\u8ba1\u7b97\u516c\u5f0f\u8be6\u89e3"},"content":{"rendered":"\n
Prometheus\u4e0ezabbix\u76f8\u6bd4\uff0c\u5b83\u7684\u5f3a\u5927\u4e4b\u5904\u5c31\u5728\u4e8e\u53ef\u4ee5\u5b83\u53ef\u4ee5\u4f7f\u7528\u7684\u5f88\u591a\u8ba1\u7b97\u516c\u5f0f\u53bb\u83b7\u53d6\u81ea\u5df1\u9700\u8981\u7684\u6570\u636e\u3002\u5f53\u7136\uff0c\u8fd9\u91cc\u6240\u6d89\u53ca\u5230\u7684\u8ba1\u7b97\u516c\u5f0f\uff0c\u4e5f\u662f\u6211\u4eec\u666e\u904d\u8ba4\u4e3a\u7684\u96be\u70b9\u6240\u5728\u3002\u6bd4\u5982\uff0c\u6211\u4eec\u8981\u83b7\u53d6CPU\u4f7f\u7528\u7387\uff0c\u4f7f\u7528zabbix\u5c31\u53ef\u4ee5\u8f7b\u6613\u83b7\u5f97\uff0c\u4f46\u662f\u5728Prometheus\u4e2d\u5374\u9700\u8981\u901a\u8fc7\u8ba1\u7b97\u516c\u5f0f\u6765\u5b8c\u6210CPU\u4f7f\u7528\u7387\u7684\u8ba1\u7b97\u3002<\/p>\n\n\n\n
\u5982\u679c\u8981\u7edf\u8ba1CPU\u7684\u4f7f\u7528\uff1anode_exporter\u4f1a\u6293\u53d6CPU\u5e38\u7528\u4f60\u76848\u79cd\u72b6\u6001\u7684\u7d2f\u8ba1\u5de5\u4f5c\u65f6\u95f4\uff0c\u7136\u540e\u518d\u7528\uff08\u6240\u6709\u975e\u7a7a\u95f2\u72b6\u6001\u7684CPU\u65f6\u95f4\u603b\u548c\uff09\/\uff08\u6240\u6709\u72b6\u6001\u7684CPU\u65f6\u95f4\u603b\u548c\uff09= CPU\u4f7f\u7528\u7387\u3002\u800c\u5982\u679c\u60f3\u8981\u83b7\u53d6\u4e2d\u95f4\u67d0\u4e00\u5206\u949f\u7684CPU\u4f7f\u7528\u65f6\u95f4\u8fd8\u9700\u8981\u7528\u5230Counter\u6570\u636e\u7c7b\u578b\u3002\u7531\u4e8eCounter\u7684\u6570\u636e\u4e00\u81f4\u662f\u589e\u91cf\uff0c\u6240\u4ee5\u9700\u8981\u622a\u53d6\u5176\u4e2d\u4e00\u6bb5\u589e\u91cf\u503c\uff0c\u7136\u540e\u518d\u62ff\u8fd9\u4e2a\u503c\u53bb\u5957\u7528\u516c\u5f0f\u8fdb\u884c\u8ba1\u7b97\u3002<\/p>\n\n\n\n
Prometheus\u4e3a\u4e0d\u540c\u7684\u6570\u636e\u63d0\u4f9b\u4e86\u975e\u5e38\u591a\u7684\u8ba1\u7b97\u51fd\u6570\uff0c\u5176\u4e2d\u6709\u4e2a\u5c0f\u6280\u5de7\u5c31\u662f\u9047\u5230counter\u6570\u636e\u7c7b\u578b\uff0c\u5728\u505a\u4efb\u4f55\u64cd\u4f5c\u4e4b\u524d\uff0c\u5148\u5957\u4e0a\u4e00\u4e2arate()\u6216\u8005increase()\u51fd\u6570\u3002\u4e0b\u9762\u662f\u4e00\u4e9b\u6bd4\u8f83\u5e38\u7528\u7684\u51fd\u6570\uff1a<\/p>\n\n\n\n
1\u3001rate\u51fd\u6570<\/strong><\/p>\n\n\n\n rate() \u51fd\u6570\u662f\u4e13\u95e8\u642d\u914dcounter\u6570\u636e\u7c7b\u578b\u4f7f\u7528\u51fd\u6570\uff0c\u529f\u80fd\u662f\u53d6counter\u5728\u8fd9\u4e2a\u65f6\u95f4\u6bb5\u4e2d\u5e73\u5747\u6bcf\u79d2\u7684\u589e\u91cf\u3002<\/p>\n\n\n\n \u4f8b\u5982\uff1a\u83b7\u53d6eth0\u7f51\u53611m\u5185\u6bcf\u79d2\u6d41\u91cf\u7684\u5e73\u5747\u503c<\/p>\n\n\n\n 2\u3001increase\u51fd\u6570<\/strong><\/p>\n\n\n\n increase() \u51fd\u6570\u8868\u793a\u67d0\u6bb5\u65f6\u95f4\u5185\u6570\u636e\u7684\u589e\u91cf<\/p>\n\n\n\n rate() \u51fd\u6570\u5219\u8868\u793a\u67d0\u6bb5\u65f6\u95f4\u5185\u6570\u636e\u7684\u5e73\u5747\u503c<\/p>\n\n\n\n \u4e24\u4e2a\u51fd\u6570\u5982\u4f55\u9009\u53d6\u4f7f\u7528\uff1f<\/p>\n\n\n\n \u5f53\u6211\u4eec\u83b7\u53d6\u6570\u636e\u6bd4\u8f83\u7cbe\u7ec6\u7684\u65f6\u5019 \u7c7b\u4f3c\u4e8e1m\u53d6\u6837\u63a8\u8350\u4f7f\u7528rate()<\/p>\n\n\n\n \u5f53\u6211\u4eec\u83b7\u53d6\u6570\u636e\u6bd4\u8f83\u7c97\u7cd9\u7684\u65f6\u5019 \u7c7b\u4f3c\u4e8e5m\uff0c10m\u751a\u81f3\u66f4\u957f\u65f6\u95f4\u53d6\u6837\u63a8\u8350\u4f7f\u7528increase()<\/p>\n\n\n\n \u4f8b\u5982\uff1a\u83b7\u53d6eth0\u7f51\u53611m\u5185\u6d41\u91cf\u7684\u589e\u91cf<\/p>\n\n\n\n 3\u3001sum\u51fd\u6570<\/strong><\/p>\n\n\n\n sum()\u51fd\u6570\u5c31\u662f\u6c42\u548c\u51fd\u6570,\u6ce8\u610f\u70b9\u662f\u5f53\u4f60\u4f7f\u7528sum\u540e\u662f\u5c06\u6240\u6709\u7684\u76d1\u63a7\u7684\u670d\u52a1\u5668\u7684\u503c\u8fdb\u884c\u53d6\u548c\uff0c\u6240\u4ee5\u5f53\u6211\u4eec\u53ea\u770b\u67d0\u4e00\u53f0\u65f6\u9700\u8981\u8fdb\u884c\u62c6\u5206<\/p>\n\n\n\n \u62c6\u5206\u5e38\u7528\u65b9\u6cd5\uff1a<\/p>\n\n\n\n by increase() 4\u3001topk\u51fd\u6570<\/strong><\/p>\n\n\n\n topk() \u51fd\u6570\u7684\u5b9a\u4e49\u662f\uff1a\u53d6\u524d\u9762x\u4f4d\u7684\u6700\u9ad8\u503c,\u6700\u7b80\u5355\u7406\u89e3\u5c31\u662f\u6570\u5b66\u7684top3 \uff0c\u5f53\u6211\u4eec\u6709\u5f88\u591a\u670d\u52a1\u5668\u6211\u4eec\u60f3\u8981\u83b7\u53d6\u67d0\u4e2akey\u7684\u6570\u636e\u6392\u5728\u524d3\u4f4d\u7684\u670d\u52a1\u5668\u3002<\/p>\n\n\n\n Gauge\u7c7b\u578b\u4f7f\u7528\u65b9\u5f0f\uff1a<\/p>\n\n\n\n Counter\u7c7b\u578b\u4f7f\u7528\u65b9\u5f0f<\/p>\n\n\n\n \u6ce8\u610f\uff1a\u6b64\u79cd\u51fd\u6570\u83b7\u5f97\u6570\u636e\u5e76\u4e0d\u662f\u5f88\u9002\u7528\u56fe\u5f62\u5316\u5c55\u793a<\/p>\n\n\n\n 5\u3001count\u51fd\u6570<\/strong><\/p>\n\n\n\n count() \u662f\u627e\u51fa\u5f53\u524d\u6216\u8005\u5386\u53f2\u6570\u636e\u4e2d\u67d0\u4e2akey\u7684\u6570\u503c\u5927\u4e8e\u6216\u5c0f\u4e8e\u67d0\u4e2a\u503c\u7684\u7edf\u8ba1\uff0c<\/p>\n\n\n\n \u4f8b\u5982\uff1a<\/p>\n\n\n\n count(node_netstat_Tcp_CurrEstab >50)<\/p>\n\n\n\n 6\u3001irate\u51fd\u6570<\/strong><\/p>\n\n\n\n \u4f8b\u5982\uff1a5m\u5185http\u8bf7\u6c42\u7684\u6bcf\u79d2\u901f\u7387<\/p>\n\n\n\n irate(http_requests_total{job=”linux-01″}[5m])<\/p>\n\n\n\n irate\u53ea\u5e94\u5728\u7ed8\u5236\u6613\u5931\u6027\u5feb\u901f\u79fb\u52a8\u8ba1\u6570\u5668\u65f6\u4f7f\u7528\u3002\u4f7f\u7528rate\u8b66\u62a5\u548c\u7f13\u6162\u79fb\u52a8\u7684\u67dc\u53f0\uff0c\u56e0\u4e3a\u5728\u623f\u4ef7\u77ed\u6682\u53d8\u5316\u53ef\u4ee5\u91cd\u8bbeFOR\u6761\u6b3e\u548c\u56fe\u8868\u5b8c\u5168\u7531\u7f55\u89c1\u5c16\u5cf0\u96be\u4ee5\u9605\u8bfb\u3002<\/p>\n\n\n\n \u6ce8\u610f\uff0c\u5f53irate()\u4e0e \u805a\u5408\u8fd0\u7b97\u7b26\uff08\u4f8b\u5982sum()\uff09\u6216\u968f\u65f6\u95f4\u805a\u5408\u7684\u51fd\u6570\uff08\u4ee5\u4efb\u4f55\u7ed3\u5c3e\u7684\u51fd\u6570_over_time\uff09\u7ec4\u5408\u65f6\uff0c\u603b\u662f\u5148\u53d6irate()\u7b2c\u4e00\u4e2a\uff0c\u7136\u540e\u805a\u5408\u3002\u5426\u5219irate()\u5728\u76ee\u6807\u91cd\u542f\u65f6\u65e0\u6cd5\u68c0\u6d4b\u5230\u8ba1\u6570\u5668\u91cd\u7f6e\u3002<\/p>\n\n\n\n 1\u3001CPU\u6a21\u5f0f<\/strong> us\uff1a\u7528\u6237\u8fdb\u7a0b\u4f7f\u7528cpu\u7684\u65f6\u95f4 2\u3001CPU\u65f6\u95f4<\/strong> curl http:\/\/localhost:9100\/metrics<\/p>\n\n\n\n \u5728\u8bf7\u6c42\u4e4b\u540e\uff0c\u4f1a\u8fd4\u56de\u5404\u79cd\u76d1\u63a7\u7684\u5185\u5bb9\uff0c\u8fd9\u91cc\u53ea\u622a\u53d6\u51facpu\u76f8\u5173\u7684\u90e8\u5206\u3002<\/p>\n\n\n\n \u4e0a\u9762\u7684\u67d0\u4e00\u884c\u5c31\u662f\u67d0\u4e00\u6838cpu\u7684\u67d0\u4e2a\u6a21\u5f0f\u7684\u8fd0\u884c\u65f6\u95f4\uff0c\u5355\u4f4d\u662f node_cpu_seconds_total{cpu=”0″,mode=”idle”} 26659.41<\/p>\n\n\n\n 3\u3001\u63a8\u5bfcCPU\u4f7f\u7528\u7387\u7684\u516c\u5f0f<\/strong><\/p>\n\n\n\n 1\uff09cpu0 5\u5206\u949f\u5185\u5904\u4e8e\u7a7a\u95f2\u72b6\u6001\u7684\u65f6\u95f4<\/p>\n\n\n\n increase(node_cpu_seconds_total{cpu=”0″,mode=”idle”}[5m]) 2\uff09cpu0 5\u5206\u949f\u5185\u5904\u4e8e\u7a7a\u95f2\u72b6\u6001\u7684\u65f6\u95f4\u5360\u6bd4\uff1a<\/p>\n\n\n\n increase(node_cpu_seconds_total{cpu=”0″,mode=”idle”}[5m]) \/ increase(node_cpu_seconds_total{cpu=”0″}[5m]) sum (increase(node_cpu_seconds_total{mode=”idle”}[5m])) \/ sum (increase(node_cpu_seconds_total{mode=”idle”}[5m]))<\/p>\n\n\n\n 4\uff09\u5982\u679c Prometheus \u76d1\u63a7\u591a\u53f0\u4e3b\u673a\uff0c\u8981\u6839\u636e\u6bcf\u53f0\u4e3b\u673a\u505a sum\uff1a<\/p>\n\n\n\n sum (increase(node_cpu_seconds_total{mode=”idle”}[5m])) by (instance) \/ sum (increase(node_cpu_seconds_total[5m])) by (instance) 100 * (1 – sum (increase(node_cpu_seconds_total{mode=”idle”}[5m])) by (instance) \/ sum (increase(node_cpu_seconds_total[5m])) by (instance)) 100 – (avg(irate(node_cpu_seconds_total{mode=”idle”}[5m])) by (instance) * 100)<\/p>\n\n\n\n 1\u3001CPU\u4f7f\u7528\u7387<\/p>\n\n\n\n 100 – (avg(irate(node_cpu_seconds_total{mode=”idle”}[5m])) by (instance) * 100) (node_memory_MemFree_bytes+node_memory_Cached_bytes+node_memory_Buffers_bytes) \/ node_memory_MemTotal_bytes * 100 100 – (node_memory_MemFree_bytes+node_memory_Cached_bytes+node_memory_Buffers_bytes) \/ node_memory_MemTotal_bytes * 100 100 – (node_filesystem_free_bytes{mountpoint=”\/”,fstype=~”ext4|xfs”} \/ node_filesystem_size_bytes{mountpoint=”\/<\/p>\n\n\n\n \u6211\u662f\u4e50\u4e50\uff0c\u5173\u6ce8\u4e50\u7ef4<\/a>\u793e\u533a\uff0c\u5b66\u4e60prometheus\u4e0d\u8ff7\u8def\uff0c\u4e13\u6ce8zabbix\u548cprometheus\u6280\u672f\u7814\u7a76\u4e0e\u5206\u4eab\uff0c\u66f4\u591a\u5f00\u6e90\u6280\u672f\u5185\u5bb9\u656c\u8bf7\u7559\u610f\u540e\u7eed\u6587\u7ae0\uff0c\u6216\u67e5\u9605\u4e50\u7ef4\u6280\u672f\u6587\u6863<\/a>\u3002\u5982\u6709prometheus\u95ee\u9898\u8fd8\u53ef\u4ee5\u5230\u4e50\u7ef4\u793e\u533a<\/a>\u63d0\u95ee\u7559\u8a00\uff0c\u4e5f\u53ef\u4ee5\u52a0\u5165\u793e\u533a\u6709\u95ee\u6709\u7b54\u6280\u672f\u4ea4\u6d41QQ\u7fa4:617295020\uff0c\u4e00\u8d77\u4ea4\u6d41\u5f00\u6e90\u6280\u672f\u5fc3\u5f97\u3002<\/p>\n\n\n\nrate(node_network_receive_bytes_total{device=\"eth0\"}[1m])<\/code><\/pre>\n\n\n\n
increase(node_network_receive_bytes_total{device=\"eth0\"}[1m])\r<\/code><\/pre>\n\n\n\n
2 by (cluster_name) \u5c5e\u4e8e\u81ea\u5b9a\u4e49\u6807\u7b7e\u4e0d\u662f\u6807\u51c6\u6807\u7b7e\uff0c\u6211\u4eec\u53ef\u4ee5\u624b\u52a8\u5c06\u4e0d\u75db\u529f\u80fd\u7684\u670d\u52a1\u5668\u8fdb\u884c\u5206\u7ec4\u5c55\u793a
\u4f8b\u5982\uff1a\u83b7\u53d6\u6240\u6709\u4e3b\u673aeth0\u7f51\u53611m\u5185\u6bcf\u79d2\u6d41\u91cf\u7684\u5e73\u5747\u503c\u7684\u548c<\/p>\n\n\n\nsum(rate(node_network_receive_bytes_total{device=\"eth0\"}[1m]))\r<\/code><\/pre>\n\n\n\n
topk(3,key)\r<\/code><\/pre>\n\n\n\n
topk(3,rate(key[1m]))\r<\/code><\/pre>\n\n\n\n
irate(v range-vector)<\/code>\u8ba1\u7b97\u8303\u56f4\u5411\u91cf\u4e2d\u65f6\u95f4\u5e8f\u5217\u7684\u6bcf\u79d2\u5373\u65f6\u589e\u957f\u7387\u3002\u8fd9\u57fa\u4e8e\u6700\u540e\u4e24\u4e2a\u6570\u636e\u70b9\u3002\u5355\u8c03\u6027\u4e2d\u65ad\uff08\u4f8b\u5982\u7531\u4e8e\u76ee\u6807\u91cd\u542f\u800c\u5bfc\u81f4\u7684\u8ba1\u6570\u5668\u91cd\u7f6e\uff09\u4f1a\u81ea\u52a8\u8c03\u6574<\/p>\n\n\n\n
\u4e8c\u3001CPU\u4f7f\u7528\u7387\u7684\u8ba1\u7b97\u65b9\u6cd5<\/h2>\n\n\n\n
\u4e00\u9897CPU\u8981\u901a\u8fc7\u5206\u65f6\u590d\u7528\u7684\u65b9\u5f0f\u8fd0\u884c\u4e8e\u4e0d\u540c\u7684\u6a21\u5f0f\u4e2d\uff0c\u8fd9\u4e9b\u6a21\u5f0f\u53ef\u4ee5\u7528\u6211\u4eec\u5e38\u7528\u7684top\u547d\u4ee4\u8fdb\u884c\u67e5\u770b\uff0c\u5176\u4e2d\u5305\u62ec\uff1a<\/p>\n\n\n\n
sy\uff1a\u5185\u6838\u8fdb\u7a0b\u4f7f\u7528cpu\u7684\u65f6\u95f4
ni\uff1a\u7528\u6237\u8fdb\u7a0b\u7a7a\u95f4\u5185\u6539\u53d8\u8fc7\u4f18\u5148\u7ea7\u7684\u8fdb\u7a0b\u4f7f\u7528\u7684cpu\u65f6\u95f4
id\uff1a\u7a7a\u95f2\uff08\u6ca1\u4eba\u7528\uff09\u7684cpu\u65f6\u95f4
wa\uff1a\u7b49\u5f85io\u7684cpu\u65f6\u95f4
hi\uff1a\u786c\u4e2d\u65ad\u7684cpu\u65f6\u95f4
si\uff1a\u8f6f\u4e2d\u65ad\u7684cpu\u65f6\u95f4
st\uff1a\u865a\u62df\u673a\u7ba1\u7406\u7a0b\u5e8f\u4f7f\u7528\u7684cpu\u65f6\u95f4
\u8fd9\u4e9b\u65f6\u95f4\u52a0\u5728\u4e00\u8d77\u662f\u603b\u7684cpu\u65f6\u95f4\u3002<\/p>\n\n\n\n
\u901a\u8fc7node-exporter\u6293\u53d6\u7684\u6307\u6807\u4e2dcpu\u76f8\u5173\u4e3b\u8981\u662f\u5404\u4e2anode_cpu_seconds_total\uff0c\u53ef\u4ee5\u901a\u8fc7\u5982\u4e0b\u7684\u65b9\u5f0f\u67e5\u770b\u6240\u6709\u7684metrics\u3002<\/p>\n\n\n\n# HELP node_cpu_seconds_total Seconds the cpus spent in each mode.\r\n# TYPE node_cpu_seconds_total counter\r\nnode_cpu_seconds_total{cpu=\"0\",mode=\"idle\"} 26659.41\r\nnode_cpu_seconds_total{cpu=\"0\",mode=\"iowait\"} 4.79\r\nnode_cpu_seconds_total{cpu=\"0\",mode=\"irq\"} 0\r\nnode_cpu_seconds_total{cpu=\"0\",mode=\"nice\"} 0\r\nnode_cpu_seconds_total{cpu=\"0\",mode=\"softirq\"} 2.69\r\nnode_cpu_seconds_total{cpu=\"0\",mode=\"steal\"} 0\r\nnode_cpu_seconds_total{cpu=\"0\",mode=\"system\"} 31.65\r\nnode_cpu_seconds_total{cpu=\"0\",mode=\"user\"} 8.67\r\nnode_cpu_seconds_total{cpu=\"1\",mode=\"idle\"} 26634.43\r\nnode_cpu_seconds_total{cpu=\"1\",mode=\"iowait\"} 54.14\r\nnode_cpu_seconds_total{cpu=\"1\",mode=\"irq\"} 0\r\nnode_cpu_seconds_total{cpu=\"1\",mode=\"nice\"} 0.02\r\nnode_cpu_seconds_total{cpu=\"1\",mode=\"softirq\"} 1.23\r\nnode_cpu_seconds_total{cpu=\"1\",mode=\"steal\"} 0\r\nnode_cpu_seconds_total{cpu=\"1\",mode=\"system\"} 34.07\r\nnode_cpu_seconds_total{cpu=\"1\",mode=\"user\"} 9\r\nnode_cpu_seconds_total{cpu=\"2\",mode=\"idle\"} 26629.89\r\nnode_cpu_seconds_total{cpu=\"2\",mode=\"iowait\"} 6.57\r\nnode_cpu_seconds_total{cpu=\"2\",mode=\"irq\"} 0\r\nnode_cpu_seconds_total{cpu=\"2\",mode=\"nice\"} 0\r\nnode_cpu_seconds_total{cpu=\"2\",mode=\"softirq\"} 1.95\r\nnode_cpu_seconds_total{cpu=\"2\",mode=\"steal\"} 0\r\nnode_cpu_seconds_total{cpu=\"2\",mode=\"system\"} 24.66\r\nnode_cpu_seconds_total{cpu=\"2\",mode=\"user\"} 7.2\r\nnode_cpu_seconds_total{cpu=\"3\",mode=\"idle\"} 26699.96\r\nnode_cpu_seconds_total{cpu=\"3\",mode=\"iowait\"} 5.72\r\nnode_cpu_seconds_total{cpu=\"3\",mode=\"irq\"} 0\r\nnode_cpu_seconds_total{cpu=\"3\",mode=\"nice\"} 0.01\r\nnode_cpu_seconds_total{cpu=\"3\",mode=\"softirq\"} 1.27\r\nnode_cpu_seconds_total{cpu=\"3\",mode=\"steal\"} 0\r\nnode_cpu_seconds_total{cpu=\"3\",mode=\"system\"} 22.32\r\nnode_cpu_seconds_total{cpu=\"3\",mode=\"user\"} 7.33\r<\/code><\/pre>\n\n\n\n
\u79d2<\/code>\u3002\u628a\u67d0\u4e00\u6838\u5404\u4e2a\u6a21\u5f0f\u7684cpu\u65f6\u95f4\u52a0\u8d77\u6765\u5c31\u662f\u6267\u884cuptime\u5f97\u5230\u7684\u7cfb\u7edf\u5f00\u673a\u4ee5\u6765\u8fd0\u884c\u8fd0\u884c\u7684\u603b\u7684\u79d2\u6570\u4e86\u3002\u4f8b\u5982\uff1a<\/p>\n\n\n\n
1
increase\u8868\u793a\u589e\u91cf\uff0c\u6240\u4ee5\u8fd9\u4e2a\u516c\u5f0f\u8868\u793a\u7684\u662f\u5f53\u524d\u65f6\u95f4\u70b9\u7684node_cpu_seconds_total\u51cf\u53bb5\u5206\u949f\u4e4b\u524d\u7684node_cpu_seconds_total\u7684\u503c\uff0c\u4e5f\u5c31\u662f\u8fd95\u5206\u949f\u5185\u5904\u4e8eidle\u72b6\u6001\u7684cpu\u65f6\u95f4\u3002<\/p>\n\n\n\n
3\uff09\u4e00\u53f0\u4e3b\u673a\u6240\u6709cpu 5\u5206\u949f\u5185\u5904\u4e8e\u7a7a\u95f2\u72b6\u6001\u7684\u65f6\u95f4\u5360\u6bd4\uff1a<\/p>\n\n\n\n
1
5\uff09cpu\u4f7f\u7528\u7387 = 1 – cpu\u7a7a\u95f2\u7387<\/p>\n\n\n\n
1
6\uff09\u6839\u636eirate()\u51fd\u6570\uff0c\u53ef\u4ee5\u7b80\u5316\u8ba1\u7b97\u516c\u5f0f\u4e3a\uff1a<\/p>\n\n\n\n\u4e09\u3001\u5e38\u7528\u8ba1\u7b97\u516c\u5f0f<\/h2>\n\n\n\n
2\u3001\u7a7a\u95f2\u5185\u5b58\u5269\u4f59\u7387<\/p>\n\n\n\n
3\u3001\u5185\u5b58\u4f7f\u7528\u7387<\/p>\n\n\n\n
4\u3001\u78c1\u76d8\u4f7f\u7528\u7387<\/p>\n\n\n\n