{"id":8703,"date":"2022-05-30T09:52:38","date_gmt":"2022-05-30T01:52:38","guid":{"rendered":"https:\/\/blog.ywdevops.cn\/?p=8703"},"modified":"2023-03-13T16:47:27","modified_gmt":"2023-03-13T08:47:27","slug":"prometheus-4","status":"publish","type":"post","link":"https:\/\/blog.ywdevops.cn\/index.php\/2022\/05\/30\/prometheus-4\/","title":{"rendered":"prometheus\u4e8c\u8fdb\u5236\u5b89\u88c5"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">1\u3001\u4e0b\u8f7dprometheus\uff0c\u4e0b\u8f7d\u5730\u5740\u5982\u4e0b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>https:&#47;&#47;github.com\/prometheus\/prometheus\/releases<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">2\u3001\u5c06\u5305\u4e0a\u4f20\u5230\u670d\u52a1\u5668\u540e\uff0c\u6267\u884c\u547d\u4ee4\u89e3\u538b\uff0c\u5982\u4e0b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>tar -xf prometheus-2.35.0.linux-amd64.tar.gz<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">3\u3001\u5c06\u89e3\u538b\u540e\u7684\u5305\u79fb\u52a8\u5230\u6307\u5b9a\u4f4d\u7f6e\uff0c\u5982\u4e0b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mv prometheus-2.35.0.linux-amd64\/* \/usr\/local\/prometheus<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">4\u3001\u521b\u5efa\u670d\u52a1\u542f\u52a8\u6587\u4ef6\uff0c\u5982\u4e0b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>cat > \/lib\/systemd\/system\/prometheus.service &lt;&lt;EOF\n&#91;Unit]\nDescription=\"prometheus\"\nDocumentation=https:\/\/prometheus.io\/\nAfter=network.target\n\n&#91;Service]\nType=simple\n\nExecStart=\/usr\/local\/prometheus\/prometheus \\\n--config.file=\/usr\/local\/prometheus\/prometheus.yml \\\n--storage.tsdb.path=\/usr\/local\/prometheus\/data --web.enable-lifecycle \\\n--enable-feature=remote-write-receiver --query.lookback-delta=2m\n\nRestart=on-failure\nSuccessExitStatus=0\nLimitNOFILE=65536\nStandardOutput=syslog\nStandardError=syslog\nSyslogIdentifier=prometheus\n\n&#91;Install]\nWantedBy=multi-user.target\nEOF\n<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">5\u3001\u52a0\u5165\u5f00\u673a\u81ea\u542f\u52a8\u5e76\u8bbe\u7f6e\u542f\u52a8\uff0c\u5982\u4e0b\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>systemctl daemon-reload\nsystemctl enable prometheus.service --now<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">6\u3001\u8bbf\u95ee\u9875\u9762\uff0c\u5982\u56fe\uff1a<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"708\" height=\"386\" src=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/05\/1-8.png\" alt=\"\" class=\"wp-image-8711\" srcset=\"https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/05\/1-8.png 708w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/05\/1-8-300x164.png 300w, https:\/\/blog.ywdevops.cn\/wp-content\/uploads\/2022\/05\/1-8-600x327.png 600w\" sizes=\"auto, (max-width: 708px) 100vw, 708px\" \/><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>1\u3001\u4e0b\u8f7dprometheus\uff0c\u4e0b\u8f7d\u5730\u5740\u5982\u4e0b\uff1a 2\u3001\u5c06\u5305\u4e0a\u4f20\u5230\u670d\u52a1\u5668\u540e\uff0c\u6267\u884c\u547d\u4ee4\u89e3\u538b\uff0c\u5982\u4e0b\uff1a 3\u3001\u5c06\u89e3\u538b\u540e\u7684\u5305\u79fb [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":8713,"comment_status":"open","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[112],"tags":[],"class_list":["post-8703","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-prometheus"],"blocksy_meta":{"styles_descriptor":{"styles":{"desktop":"","tablet":"","mobile":""},"google_fonts":[],"version":8}},"_links":{"self":[{"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/posts\/8703","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/comments?post=8703"}],"version-history":[{"count":10,"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/posts\/8703\/revisions"}],"predecessor-version":[{"id":12077,"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/posts\/8703\/revisions\/12077"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/media\/8713"}],"wp:attachment":[{"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/media?parent=8703"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/categories?post=8703"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.ywdevops.cn\/index.php\/wp-json\/wp\/v2\/tags?post=8703"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}