{"id":15880,"date":"2024-10-05T09:43:41","date_gmt":"2024-10-05T01:43:41","guid":{"rendered":"https:\/\/www.yunshan.net\/blog\/?p=15880"},"modified":"2024-10-05T09:43:41","modified_gmt":"2024-10-05T01:43:41","slug":"prometheus%e7%9a%84%e4%bc%a0%e5%a5%87%e6%95%85%e4%ba%8b%ef%bc%9a%e4%bb%8e%e8%af%9e%e7%94%9f%e5%88%b0%e5%bc%95%e9%a2%86%e6%97%b6%e4%bb%a3%e6%bd%ae%e6%b5%81","status":"publish","type":"post","link":"https:\/\/www.yunshan.net\/blog\/archives\/15880.html","title":{"rendered":"Prometheus\u7684\u4f20\u5947\u6545\u4e8b\uff1a\u4ece\u8bde\u751f\u5230\u5f15\u9886\u65f6\u4ee3\u6f6e\u6d41"},"content":{"rendered":"<p>\t\t\t\t<![CDATA[\n\n<p><a href=\"https:\/\/www.yunshan.net\" target=\"_blank\" style=\"color:blue\" rel=\"noopener noreferrer\">Prometheus<\/a>\u4f5c\u4e3a\u4e00\u6b3e\u5f00\u6e90\u7684\u76d1\u63a7\u7cfb\u7edf\u548c\u65f6\u95f4\u5e8f\u5217\u6570\u636e\u5e93\uff0c\u5728\u5f53\u4eca\u7684\u6280\u672f\u9886\u57df\u4e2d\u5360\u636e\u7740\u91cd\u8981\u7684\u5730\u4f4d\u3002\u5b83\u7684\u8bde\u751f\u5e76\u975e\u5076\u7136\uff0c\u800c\u662f\u4e3a\u4e86\u89e3\u51b3\u5f53\u65f6\u76d1\u63a7\u9886\u57df\u7684\u4e00\u7cfb\u5217\u75db\u70b9\u548c\u9700\u6c42\u3002<\/p>\n\n\n\n\n<p>\u5728<a href=\"https:\/\/www.yunshan.net\" target=\"_blank\" style=\"color:blue\" rel=\"noopener noreferrer\">Prometheus<\/a>\u51fa\u73b0\u4e4b\u524d\uff0c\u76d1\u63a7\u9886\u57df\u9762\u4e34\u7740\u8bf8\u591a\u6311\u6218\u3002\u4f20\u7edf\u7684\u76d1\u63a7\u5de5\u5177\u5f80\u5f80\u5b58\u5728\u7740\u6269\u5c55\u6027\u5dee\u3001\u914d\u7f6e\u590d\u6742\u3001\u6570\u636e\u5b58\u50a8\u548c\u67e5\u8be2\u6548\u7387\u4f4e\u4e0b\u7b49\u95ee\u9898\u3002\u968f\u7740\u4e91\u8ba1\u7b97\u548c\u5fae\u670d\u52a1\u67b6\u6784\u7684\u5174\u8d77\uff0c\u7cfb\u7edf\u7684\u89c4\u6a21\u548c\u590d\u6742\u6027\u6025\u5267\u589e\u52a0\uff0c\u5bf9\u76d1\u63a7\u7cfb\u7edf\u7684\u8981\u6c42\u4e5f\u8d8a\u6765\u8d8a\u9ad8\u3002<\/p>\n\n\n\n<p align=center><img decoding=\"async\" src=\"https:\/\/www.yunshan.net\/blog\/wp-content\/uploads\/2024\/10\/20D6C.jpg\" \/><\/p>\n\n\n\n\n<p>Prometheus\u7684\u8bde\u751f\u53ef\u4ee5\u8ffd\u6eaf\u5230SoundCloud\u516c\u53f8\u3002\u5f53\u65f6\uff0cSoundCloud\u7684\u5de5\u7a0b\u5e08\u4eec\u9700\u8981\u4e00\u79cd\u80fd\u591f\u9002\u5e94\u5176\u5feb\u901f\u53d1\u5c55\u7684\u6280\u672f\u67b6\u6784\u7684\u76d1\u63a7\u89e3\u51b3\u65b9\u6848\u3002\u4e8e\u662f\uff0c\u4ed6\u4eec\u5f00\u59cb\u7740\u624b\u5f00\u53d1Prometheus\uff0c\u5e76\u4e8e2012\u5e74\u5c06\u5176\u5f00\u6e90\u3002<\/p>\n\n\n\n\n<p>Prometheus\u7684\u8bbe\u8ba1\u7406\u5ff5\u5177\u6709\u8bb8\u591a\u521b\u65b0\u4e4b\u5904\u3002\u5b83\u91c7\u7528\u4e86\u62c9\u53d6\uff08Pull\uff09\u7684\u65b9\u5f0f\u6765\u83b7\u53d6\u76d1\u63a7\u6570\u636e\uff0c\u800c\u4e0d\u662f\u4f20\u7edf\u7684\u63a8\u9001\uff08Push\uff09\u65b9\u5f0f\u3002\u8fd9\u79cd\u62c9\u53d6\u6a21\u5f0f\u4f7f\u5f97Prometheus\u80fd\u591f\u66f4\u52a0\u7075\u6d3b\u5730\u63a7\u5236\u6570\u636e\u91c7\u96c6\u7684\u9891\u7387\u548c\u65f6\u673a\uff0c\u540c\u65f6\u4e5f\u51cf\u8f7b\u4e86\u88ab\u76d1\u63a7\u7aef\u7684\u8d1f\u62c5\u3002<\/p>\n\n\n\n\n<p>\u5728\u6570\u636e\u5b58\u50a8\u65b9\u9762\uff0cPrometheus\u4f7f\u7528\u4e86\u4e00\u79cd\u9ad8\u6548\u7684\u65f6\u95f4\u5e8f\u5217\u6570\u636e\u5e93\u3002\u5b83\u80fd\u591f\u5feb\u901f\u5730\u5b58\u50a8\u548c\u67e5\u8be2\u5927\u91cf\u7684\u76d1\u63a7\u6570\u636e\uff0c\u5e76\u4e14\u652f\u6301\u9ad8\u5e76\u53d1\u7684\u8bfb\u5199\u64cd\u4f5c\u3002\u8fd9\u4f7f\u5f97\u7528\u6237\u53ef\u4ee5\u5b9e\u65f6\u5730\u83b7\u53d6\u7cfb\u7edf\u7684\u72b6\u6001\u4fe1\u606f\uff0c\u5e76\u8fdb\u884c\u5feb\u901f\u7684\u6545\u969c\u8bca\u65ad\u548c\u6027\u80fd\u5206\u6790\u3002<\/p>\n\n\n\n\n<p>Prometheus\u8fd8\u5177\u6709\u5f3a\u5927\u7684\u6307\u6807\u5b9a\u4e49\u548c\u67e5\u8be2\u8bed\u8a00\uff08PromQL\uff09\u3002\u7528\u6237\u53ef\u4ee5\u4f7f\u7528PromQL\u6765\u5b9a\u4e49\u5404\u79cd\u590d\u6742\u7684\u76d1\u63a7\u6307\u6807\uff0c\u5e76\u8fdb\u884c\u7075\u6d3b\u7684\u67e5\u8be2\u548c\u805a\u5408\u64cd\u4f5c\u3002\u8fd9\u79cd\u8bed\u8a00\u7684\u7075\u6d3b\u6027\u4f7f\u5f97\u7528\u6237\u80fd\u591f\u6839\u636e\u81ea\u5df1\u7684\u9700\u6c42\u5b9a\u5236\u5316\u5730\u83b7\u53d6\u76d1\u63a7\u6570\u636e\uff0c\u4ece\u800c\u66f4\u597d\u5730\u7406\u89e3\u7cfb\u7edf\u7684\u8fd0\u884c\u72b6\u51b5\u3002<\/p>\n\n\n\n\n<p>\u9664\u4e86\u4e0a\u8ff0\u7684\u6838\u5fc3\u529f\u80fd\u5916\uff0cPrometheus\u8fd8\u62e5\u6709\u4e30\u5bcc\u7684\u751f\u6001\u7cfb\u7edf\u3002\u5b83\u4e0e\u4f17\u591a\u7684\u5f00\u6e90\u5de5\u5177\u548c\u6846\u67b6\u96c6\u6210\uff0c\u5982Grafana\u7528\u4e8e\u6570\u636e\u53ef\u89c6\u5316\u3001Alertmanager\u7528\u4e8e\u544a\u8b66\u7ba1\u7406\u7b49\u3002\u8fd9\u4e9b\u96c6\u6210\u4f7f\u5f97\u7528\u6237\u80fd\u591f\u6784\u5efa\u4e00\u4e2a\u5b8c\u6574\u7684\u76d1\u63a7\u89e3\u51b3\u65b9\u6848\uff0c\u6ee1\u8db3\u4ece\u6570\u636e\u91c7\u96c6\u3001\u5b58\u50a8\u3001\u5206\u6790\u5230\u544a\u8b66\u7684\u5168\u6d41\u7a0b\u9700\u6c42\u3002<\/p>\n\n\n\n\n<p>\u968f\u7740\u65f6\u95f4\u7684\u63a8\u79fb\uff0cPrometheus\u9010\u6e10\u5f15\u9886\u4e86\u65f6\u4ee3\u6f6e\u6d41\u3002\u8d8a\u6765\u8d8a\u591a\u7684\u4f01\u4e1a\u548c\u7ec4\u7ec7\u5f00\u59cb\u91c7\u7528Prometheus\u4f5c\u4e3a\u5176\u76d1\u63a7\u7cfb\u7edf\u7684\u6838\u5fc3\u7ec4\u4ef6\u3002\u5b83\u4e0d\u4ec5\u5728\u4e91\u8ba1\u7b97\u9886\u57df\u5f97\u5230\u4e86\u5e7f\u6cdb\u7684\u5e94\u7528\uff0c\u8fd8\u5728\u4f20\u7edf\u7684\u4f01\u4e1a\u7ea7\u73af\u5883\u4e2d\u53d1\u6325\u7740\u91cd\u8981\u7684\u4f5c\u7528\u3002<\/p>\n\n\n\n\n<p>\u5728\u4e91\u8ba1\u7b97\u73af\u5883\u4e2d\uff0cPrometheus\u80fd\u591f\u5f88\u597d\u5730\u9002\u5e94\u5bb9\u5668\u5316\u548c\u5fae\u670d\u52a1\u67b6\u6784\u3002\u5b83\u53ef\u4ee5\u8f7b\u677e\u5730\u76d1\u63a7Kubernetes\u96c6\u7fa4\u4e2d\u7684\u5404\u79cd\u8d44\u6e90\u548c\u5e94\u7528\uff0c\u4e3a\u4e91\u539f\u751f\u5e94\u7528\u7684\u8fd0\u7ef4\u63d0\u4f9b\u4e86\u6709\u529b\u7684\u652f\u6301\u3002<\/p>\n\n\n\n\n<p>\u5728\u4f01\u4e1a\u7ea7\u73af\u5883\u4e2d\uff0cPrometheus\u4e5f\u80fd\u591f\u4e0e\u73b0\u6709\u7684\u76d1\u63a7\u4f53\u7cfb\u8fdb\u884c\u96c6\u6210\uff0c\u8865\u5145\u548c\u5b8c\u5584\u76d1\u63a7\u7684\u8986\u76d6\u8303\u56f4\u548c\u529f\u80fd\u3002\u5b83\u7684\u5f00\u6e90\u7279\u6027\u548c\u6d3b\u8dc3\u7684\u793e\u533a\u4f7f\u5f97\u4f01\u4e1a\u53ef\u4ee5\u6839\u636e\u81ea\u8eab\u7684\u9700\u6c42\u8fdb\u884c\u5b9a\u5236\u5316\u5f00\u53d1\u548c\u6269\u5c55\uff0c\u964d\u4f4e\u4e86\u76d1\u63a7\u7cfb\u7edf\u7684\u6210\u672c\u548c\u98ce\u9669\u3002<\/p>\n\n\n\n\n<p>\u4e91\u6749\u7f51\u7edc\u4f5c\u4e3a\u4e00\u5bb6\u4e13\u6ce8\u4e8e<a href=\"https:\/\/www.yunshan.net\" target=\"_blank\" style=\"color:blue\" rel=\"noopener noreferrer\">\u7f51\u7edc\u6d41\u91cf\u91c7\u96c6<\/a>\u5206\u53d1\u7684\u4f01\u4e1a\uff0c\u4e5f\u5728\u79ef\u6781\u5730\u63a2\u7d22\u548c\u5e94\u7528Prometheus\u6280\u672f\u3002<a href=\"https:\/\/www.yunshan.net\" target=\"_blank\" style=\"color:blue\" rel=\"noopener noreferrer\">\u7f51\u7edc\u6d41\u91cf\u91c7\u96c6<\/a>\u5206\u53d1\u662f\u4fdd\u969c\u7f51\u7edc\u6027\u80fd\u548c\u5b89\u5168\u7684\u5173\u952e\u73af\u8282\uff0c\u800cPrometheus\u53ef\u4ee5\u4e3a\u4e91\u6749\u7f51\u7edc\u7684\u89e3\u51b3\u65b9\u6848\u63d0\u4f9b\u5f3a\u5927\u7684\u76d1\u63a7\u548c\u5206\u6790\u80fd\u529b\u3002<\/p>\n\n\n\n\n<p>\u901a\u8fc7\u5c06\u7f51\u7edc\u6d41\u91cf\u6570\u636e\u4e0ePrometheus\u8fdb\u884c\u96c6\u6210\uff0c\u4e91\u6749\u7f51\u7edc\u80fd\u591f\u5b9e\u65f6\u5730\u76d1\u6d4b\u7f51\u7edc\u7684\u6d41\u91cf\u72b6\u51b5\u3001\u5e94\u7528\u7684\u6027\u80fd\u6307\u6807\u4ee5\u53ca\u6f5c\u5728\u7684\u5b89\u5168\u5a01\u80c1\u3002\u5229\u7528Prometheus\u7684\u544a\u8b66\u529f\u80fd\uff0c\u4e91\u6749\u7f51\u7edc\u53ef\u4ee5\u53ca\u65f6\u5730\u5411\u8fd0\u7ef4\u4eba\u5458\u53d1\u9001\u9884\u8b66\u4fe1\u606f\uff0c\u5e2e\u52a9\u4ed6\u4eec\u5feb\u901f\u54cd\u5e94\u548c\u89e3\u51b3\u95ee\u9898\u3002<\/p>\n\n\n\n\n<p>\u6b64\u5916\uff0c\u4e91\u6749\u7f51\u7edc\u8fd8\u53ef\u4ee5\u501f\u52a9Prometheus\u7684\u6570\u636e\u5206\u6790\u80fd\u529b\uff0c\u5bf9\u957f\u671f\u79ef\u7d2f\u7684\u7f51\u7edc\u6d41\u91cf\u6570\u636e\u8fdb\u884c\u6df1\u5165\u6316\u6398\u548c\u5206\u6790\u3002\u901a\u8fc7\u53d1\u73b0\u6570\u636e\u4e2d\u7684\u8d8b\u52bf\u548c\u6a21\u5f0f\uff0c\u4e91\u6749\u7f51\u7edc\u80fd\u591f\u4e3a\u4f01\u4e1a\u63d0\u4f9b\u66f4\u5177\u524d\u77bb\u6027\u7684\u7f51\u7edc\u4f18\u5316\u5efa\u8bae\u548c\u5b89\u5168\u7b56\u7565\u3002<\/p>\n\n\n\n\n<p>\u603b\u4e4b\uff0cPrometheus\u7684\u51fa\u73b0\u4e3a\u76d1\u63a7\u9886\u57df\u5e26\u6765\u4e86\u9769\u547d\u6027\u7684\u53d8\u5316\u3002\u5b83\u7684\u521b\u65b0\u8bbe\u8ba1\u3001\u5f3a\u5927\u529f\u80fd\u548c\u6d3b\u8dc3\u7684\u751f\u6001\u7cfb\u7edf\u4f7f\u5f97\u5b83\u6210\u4e3a\u4e86\u5f53\u4eca\u65f6\u4ee3\u76d1\u63a7\u7cfb\u7edf\u7684\u9996\u9009\u4e4b\u4e00\u3002\u800c\u4e91\u6749\u7f51\u7edc\u7b49\u4f01\u4e1a\u7684\u79ef\u6781\u5e94\u7528\u548c\u521b\u65b0\uff0c\u4e5f\u5c06\u8fdb\u4e00\u6b65\u63a8\u52a8Prometheus\u5728\u7f51\u7edc\u6d41\u91cf\u91c7\u96c6\u5206\u53d1\u7b49\u9886\u57df\u7684\u53d1\u5c55\u548c\u5e94\u7528\uff0c\u4e3a\u6784\u5efa\u66f4\u52a0\u667a\u80fd\u3001\u9ad8\u6548\u548c\u5b89\u5168\u7684\u7f51\u7edc\u73af\u5883\u505a\u51fa\u8d21\u732e\u3002<\/p>\n\n\n\n\n<p>\u672a\u6765\uff0c\u968f\u7740\u6280\u672f\u7684\u4e0d\u65ad\u8fdb\u6b65\u548c\u5e94\u7528\u573a\u666f\u7684\u4e0d\u65ad\u62d3\u5c55\uff0cPrometheus\u6709\u671b\u7ee7\u7eed\u5f15\u9886\u76d1\u63a7\u9886\u57df\u7684\u53d1\u5c55\u6f6e\u6d41\u3002\u5b83\u5c06\u4e0d\u65ad\u5730\u5b8c\u5584\u548c\u4f18\u5316\u81ea\u8eab\u7684\u529f\u80fd\uff0c\u66f4\u597d\u5730\u6ee1\u8db3\u7528\u6237\u65e5\u76ca\u589e\u957f\u7684\u9700\u6c42\u3002\u540c\u65f6\uff0c\u5b83\u4e5f\u5c06\u4e0e\u5176\u4ed6\u65b0\u5174\u6280\u672f\u5982\u4eba\u5de5\u667a\u80fd\u3001\u5927\u6570\u636e\u7b49\u6df1\u5ea6\u878d\u5408\uff0c\u4e3a\u76d1\u63a7\u548c\u8fd0\u7ef4\u5e26\u6765\u66f4\u591a\u7684\u53ef\u80fd\u6027\u3002\u76f8\u4fe1\u5728Prometheus\u7684\u52a9\u529b\u4e0b\uff0c\u6211\u4eec\u5c06\u80fd\u591f\u66f4\u52a0\u8f7b\u677e\u5730\u5e94\u5bf9\u65e5\u76ca\u590d\u6742\u7684\u6280\u672f\u6311\u6218\uff0c\u6784\u5efa\u66f4\u52a0\u7a33\u5b9a\u3001\u53ef\u9760\u548c\u9ad8\u6548\u7684\u4fe1\u606f\u7cfb\u7edf\u3002<\/p>\n\n]]>\t\t<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\t\t\t\t<![CDATA[]]>\t\t<\/p>\n","protected":false},"author":5,"featured_media":15881,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-15880","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-discussion"],"_links":{"self":[{"href":"https:\/\/www.yunshan.net\/blog\/wp-json\/wp\/v2\/posts\/15880","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.yunshan.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.yunshan.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.yunshan.net\/blog\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/www.yunshan.net\/blog\/wp-json\/wp\/v2\/comments?post=15880"}],"version-history":[{"count":0,"href":"https:\/\/www.yunshan.net\/blog\/wp-json\/wp\/v2\/posts\/15880\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.yunshan.net\/blog\/wp-json\/"}],"wp:attachment":[{"href":"https:\/\/www.yunshan.net\/blog\/wp-json\/wp\/v2\/media?parent=15880"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.yunshan.net\/blog\/wp-json\/wp\/v2\/categories?post=15880"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.yunshan.net\/blog\/wp-json\/wp\/v2\/tags?post=15880"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}