{"id":1553,"date":"2023-03-25T15:39:12","date_gmt":"2023-03-25T07:39:12","guid":{"rendered":"https:\/\/www.appblog.cn\/?p=1553"},"modified":"2023-04-27T21:37:53","modified_gmt":"2023-04-27T13:37:53","slug":"deploying-prometheus-under-centos","status":"publish","type":"post","link":"https:\/\/www.appblog.cn\/index.php\/2023\/03\/25\/deploying-prometheus-under-centos\/","title":{"rendered":"CentOS\u4e0b\u90e8\u7f72Prometheus"},"content":{"rendered":"<h2>Prometheus\u4ecb\u7ecd<\/h2>\n<p>Prometheus\u662f\u4e00\u4e2a\u5f00\u6e90\u7684\u7cfb\u7edf\u76d1\u63a7\u548c\u62a5\u8b66\u7684\u5de5\u5177\u5305\uff0c\u6700\u521d\u7531SoundCloud\u53d1\u5e03\u3002<\/p>\n<p>\u5b98\u65b9\u7f51\u5740\uff1a<a target=\"_blank\" rel=\"noopener\" href=\"https:\/\/prometheus.io\/\">https:\/\/prometheus.io\/<\/a><br \/>\n\u8f6f\u4ef6\u4e0b\u8f7d\uff1a<a target=\"_blank\" rel=\"noopener\" href=\"https:\/\/prometheus.io\/download\/\">https:\/\/prometheus.io\/download\/<\/a><br \/>\nGitHub\uff1a<a target=\"_blank\" rel=\"noopener\" href=\"https:\/\/github.com\/prometheus\/prometheus\">https:\/\/github.com\/prometheus\/prometheus<\/a><br \/>\nGithub Release\uff1a<a target=\"_blank\" rel=\"noopener\" href=\"https:\/\/github.com\/prometheus\/prometheus\/releases\/\">https:\/\/github.com\/prometheus\/prometheus\/releases\/<\/a><br \/>\nPrometheus Exporters\uff1a<a target=\"_blank\" rel=\"noopener\" href=\"https:\/\/prometheus.io\/docs\/instrumenting\/exporters\/\">https:\/\/prometheus.io\/docs\/instrumenting\/exporters\/<\/a><\/p>\n<p><!-- more --><\/p>\n<p>\u7279\u70b9\uff1a<\/p>\n<ul>\n<li>\u591a\u7ef4\u6570\u636e\u6a21\u578b\uff08\u6709metric\u540d\u79f0\u548c\u952e\u503c\u5bf9\u786e\u5b9a\u7684\u65f6\u95f4\u5e8f\u5217\uff09<\/li>\n<li>\u7075\u6d3b\u7684\u67e5\u8be2\u8bed\u8a00<\/li>\n<li>\u4e0d\u4f9d\u8d56\u5206\u5e03\u5f0f\u5b58\u50a8<\/li>\n<li>\u901a\u8fc7pull\u65b9\u5f0f\u91c7\u96c6\u65f6\u95f4\u5e8f\u5217\uff0c\u901a\u8fc7http\u534f\u8bae\u4f20\u8f93<\/li>\n<li>\u652f\u6301\u901a\u8fc7\u4e2d\u4ecb\u7f51\u5173\u7684push\u65f6\u95f4\u5e8f\u5217\u7684\u65b9\u5f0f<\/li>\n<li>\u76d1\u63a7\u6570\u636e\u901a\u8fc7\u670d\u52a1\u6216\u8005\u9759\u6001\u914d\u7f6e\u6765\u53d1\u73b0<\/li>\n<li>\u652f\u6301\u56fe\u8868\u548cdashboard\u7b49\u591a\u79cd\u65b9\u5f0f<\/li>\n<\/ul>\n<p>\u7ec4\u4ef6\uff1a<\/p>\n<ul>\n<li><code>Prometheus<\/code> \u4e3b\u7a0b\u5e8f\uff0c\u4e3b\u8981\u662f\u8d1f\u8d23\u5b58\u50a8\u3001\u6293\u53d6\u3001\u805a\u5408\u3001\u67e5\u8be2\u65b9\u9762<\/li>\n<li><code>Alertmanager<\/code> \u7a0b\u5e8f\uff0c\u4e3b\u8981\u662f\u8d1f\u8d23\u5b9e\u73b0\u62a5\u8b66\u529f\u80fd<\/li>\n<li><code>Pushgateway<\/code> \u7a0b\u5e8f\uff0c\u4e3b\u8981\u662f\u5b9e\u73b0\u63a5\u6536\u7531Client push\u8fc7\u6765\u7684\u6307\u6807\u6570\u636e\uff0c\u5728\u6307\u5b9a\u7684\u65f6\u95f4\u95f4\u9694\uff0c\u7531\u4e3b\u7a0b\u5e8f\u6765\u6293\u53d6<\/li>\n<li><code>*_exporter<\/code> \u8fd9\u7c7b\u662f\u4e0d\u540c\u7cfb\u7edf\u5df2\u7ecf\u5b9e\u73b0\u4e86\u7684\u96c6\u6210<\/li>\n<\/ul>\n<h2>Prometheus\u90e8\u7f72<\/h2>\n<p>\uff081\uff09\u5b89\u88c5\u53ca\u914d\u7f6e<\/p>\n<pre><code># tar -zxf prometheus-2.11.1.linux-amd64.tar.gz -C \/usr\/local\/\n# mv \/usr\/local\/prometheus-2.11.1.linux-amd64 \/usr\/local\/prometheus\n# cd \/usr\/local\/prometheus\n# vim prometheus.yml<\/code><\/pre>\n<pre><code class=\"language-yml\">scrape_interval: 15s   # \u9ed8\u8ba415\u79d2\u5230\u76ee\u6807\u5904\u6293\u53d6\u6570\u636e<\/code><\/pre>\n<p>\uff082\uff09\u542f\u52a8<\/p>\n<pre><code>nohup .\/prometheus --config.file=prometheus.yml &amp;\nnohup .\/prometheus --config.file=prometheus.yml --web.enable-lifecycle &amp;<\/code><\/pre>\n<pre><code>curl -s -XPOST localhost:9090\/-\/reload<\/code><\/pre>\n<p>\uff083\uff09WEB\u9875\u9762\u8bbf\u95ee\uff1a<a target=\"_blank\" rel=\"noopener\" href=\"http:\/\/localhost:9090\/\">http:\/\/localhost:9090\/<\/a> \uff0c\u53ef\u4ee5\u770b\u5230Prometheus\u7684graph\u9875\u9762<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Prometheus\u4ecb\u7ecd Prometheus\u662f\u4e00\u4e2a\u5f00\u6e90\u7684\u7cfb\u7edf\u76d1\u63a7\u548c\u62a5\u8b66\u7684\u5de5\u5177\u5305\uff0c\u6700\u521d\u7531SoundCloud\u53d1 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[386],"tags":[387],"class_list":["post-1553","post","type-post","status-publish","format-standard","hentry","category-monitor","tag-prometheus"],"_links":{"self":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/1553","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/comments?post=1553"}],"version-history":[{"count":0,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/posts\/1553\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/media?parent=1553"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/categories?post=1553"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appblog.cn\/index.php\/wp-json\/wp\/v2\/tags?post=1553"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}