{"id":12389,"date":"2025-04-18T19:32:07","date_gmt":"2025-04-18T11:32:07","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/12389.html"},"modified":"2025-04-18T19:32:07","modified_gmt":"2025-04-18T11:32:07","slug":"prometheus%e5%ae%89%e8%a3%85%e9%83%a8%e7%bd%b2","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/12389.html","title":{"rendered":"Prometheus\u5b89\u88c5\u90e8\u7f72"},"content":{"rendered":"<\/p>\n<h4>\u6587\u7ae0\u76ee\u5f55<\/h4>\n<ul>\n<li>1.Prometheus(\u666e\u7f57\u7c73\u4fee\u65af)\u5b89\u88c5\u90e8\u7f72<\/li>\n<li>\n<ul>\n<li>1.1\u90e8\u7f72\u73af\u5883\u51c6\u5907<\/li>\n<li>1.2\u90e8\u7f72prometheus<\/li>\n<li>1.3\u4e3b\u673a\u6570\u636e\u5c55\u793a<\/li>\n<\/ul>\n<\/li>\n<li>2.Grafana\u5b89\u88c5\u90e8\u7f72<\/li>\n<li>\n<ul>\n<li>2.1\u90e8\u7f72Grafana<\/li>\n<li>2.2\u914d\u7f6eGrafana\u6570\u636e\u6e90<\/li>\n<li>2.2\u914d\u7f6eGrafana\u4eea\u8868\u677f<\/li>\n<\/ul>\n<\/li>\n<li>3.AlertManager\u5b89\u88c5\u90e8\u7f72<\/li>\n<li>\n<ul>\n<li>3.1\u90e8\u7f72alertmanager<\/li>\n<li>3.2\u544a\u8b66\u90ae\u4ef6\u53d1\u9001\u914d\u7f6e<\/li>\n<li>3.3\u6d4b\u8bd5\u90ae\u4ef6\u544a\u8b66\u6548\u679c<\/li>\n<li>3.4\u81ea\u5b9a\u4e49\u90ae\u4ef6\u544a\u8b66\u6a21\u677f<\/li>\n<li>3.5\u9489\u9489\u63a5\u6536\u544a\u8b66\u914d\u7f6e<\/li>\n<li>3.6\u6d4b\u8bd5\u9489\u9489\u63a5\u6536\u544a\u8b66\u6548\u679c<\/li>\n<\/ul>\n<\/li>\n<li>4.Redis\u670d\u52a1\u76d1\u63a7<\/li>\n<li>\n<ul>\n<li>4.1\u90e8\u7f72redis_exporter<\/li>\n<li>4.2 prometheus\u6dfb\u52a0\u76d1\u63a7\u76ee\u6807<\/li>\n<li>4.3\u6dfb\u52a0Redis Grafana\u6a21\u677f<\/li>\n<\/ul>\n<\/li>\n<li>5.Rabbitmq\u670d\u52a1\u76d1\u63a7<\/li>\n<li>\n<ul>\n<li>5.1\u90e8\u7f72rabbitmq_exporter<\/li>\n<li>5.2 prometheus\u6dfb\u52a0\u76d1\u63a7\u76ee\u6807<\/li>\n<li>5.3\u6dfb\u52a0Rabbitmq Grafana\u6a21\u677f<\/li>\n<\/ul>\n<\/li>\n<li>6.mysql\u670d\u52a1\u76d1\u63a7<\/li>\n<li>\n<ul>\n<li>6.1\u90e8\u7f72mysqld_exporter<\/li>\n<li>6.2 prometheus\u6dfb\u52a0\u76d1\u63a7\u76ee\u6807<\/li>\n<li>6.3\u6dfb\u52a0mysql Grafana\u6a21\u677f<\/li>\n<\/ul>\n<\/li>\n<li>7.Linux\u4e3b\u673a\u76d1\u63a7<\/li>\n<li>\n<ul>\n<li>7.1\u90e8\u7f72node_exporter<\/li>\n<li>7.2 prometheus\u6dfb\u52a0\u76d1\u63a7\u76ee\u6807<\/li>\n<li>7.3\u6dfb\u52a0Linux Grafana\u6a21\u677f<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h2>1.Prometheus(\u666e\u7f57\u7c73\u4fee\u65af)\u5b89\u88c5\u90e8\u7f72<\/h2>\n<p>Prometheus\u662f\u4e00\u4e2a\u5f00\u6e90\u7684\u7cfb\u7edf\u76d1\u63a7\u548c\u62a5\u8b66\u7cfb\u7edf\uff0c\u73b0\u5728\u5df2\u7ecf\u52a0\u5165\u5230CNCF\u57fa\u91d1\u4f1a\uff0c\u6210\u4e3a\u7ee7k8s\u4e4b\u540e\u7b2c\u4e8c\u4e2a\u5728CNCF\u6258\u7ba1\u7684\u9879\u76ee\uff0c\u5728kubernetes\u5bb9\u5668\u7ba1\u7406\u7cfb\u7edf\u4e2d\uff0c\u901a\u5e38\u4f1a\u642d\u914dprometheus\u8fdb\u884c\u76d1\u63a7\uff0c\u540c\u65f6\u4e5f\u652f\u6301\u591a\u79cdexporter\u91c7\u96c6\u6570\u636e\uff0c\u8fd8\u652f\u6301pushgateway\u8fdb\u884c\u6570\u636e\u4e0a\uff0c Prometheus\u6027\u80fd\u8db3\u591f\u652f\u6491\u4e0a\u4e07\u53f0\u89c4\u6a21\u7684\u96c6\u7fa4\u3002 \u5b98\u7f51\uff1ahttps:\/\/prometheus.io\/<\/p>\n<h3>1.1\u90e8\u7f72\u73af\u5883\u51c6\u5907<\/h3>\n<p>\u90e8\u7f72\u73af\u5883\u4fe1\u606f\uff1a \u64cd\u4f5c\u7cfb\u7edf\u7248\u672c\uff1aCetnos7.9<\/p>\n<table>\n<tr>\n   IP\u5730\u5740<br \/>\n   \u4e3b\u673a\u540d<br \/>\n   \u8eab\u4efd<br \/>\n  <\/tr>\n<tbody>\n<tr>\n<td>192.168.0.123<\/td>\n<td>prometheus<\/td>\n<td>prometheus\u670d\u52a1\u5668<\/td>\n<\/tr>\n<tr>\n<td>192.168.0.124<\/td>\n<td>grafana<\/td>\n<td>grafana\u670d\u52a1\u5668<\/td>\n<\/tr>\n<tr>\n<td>192.168.0.125<\/td>\n<td>client<\/td>\n<td>\u88ab\u76d1\u63a7\u5ba2\u6237\u7aef<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u5173\u95ed\u9632\u706b\u5899\uff1a 3\u53f0\u4e3b\u673a\u90fd\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a systemctl stop firewalld \u5173\u95ed\u9632\u706b\u5899 systemctl disable firewalld \u5f00\u673a\u7981\u6b62\u9632\u706b\u5899\u542f\u52a8 <img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418113204-68023834b1a0f.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\"> \u5173\u95edselinux\uff1a 3\u53f0\u4e3b\u673a\u90fd\u6267\u884c\u547d\u4ee4\uff1asetenforce 0 <img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418113204-68023834c73e9.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\"> \u7136\u540e\u5c06\/etc\/selinux\/config\u91cc\u7684\u53c2\u6570SELINUX=enforcing\u4fee\u6539\u4e3aSELINUX=disabled\uff0c\u6c38\u4e45\u5173\u95edselinux <img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418113204-68023834d2623.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\"> \u4fee\u6539\u4e3b\u673a\u540d\uff1a 3\u53f0\u4e3b\u673a\u5404\u81ea\u4fee\u6539\u6210\u5bf9\u5e94\u4e3b\u673a\u540d\uff1ahostnamectl set-hostname hostname<\/p>\n<h3>1.2\u90e8\u7f72prometheus<\/h3>\n<p>\u4e0b\u8f7d\u5b89\u88c5\u5305\uff1a \u5730\u5740\uff1ahttps:\/\/prometheus.io\/download\/ <img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418113204-68023834e106d.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\"> \u4e0a\u4f20\u5b89\u88c5\u5305\uff1a \u5c06prometheus-2.40.1.linux-amd64.tar.gz\u5b89\u88c5\u5305\u4e0a\u4f20\u81f3192.168.0.123\u670d\u52a1\u5668 <img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418113204-68023834f1c21.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\"> \u89e3\u538b\u5e76\u542f\u52a8prometheus\uff1a<\/p>\n<p>\u4ee5\u4e0b\u547d\u4ee4\u6309\u987a\u5e8f\u6267\u884c\uff0c\u89e3\u538b\u5b89\u88c5\u5305 -&gt; \u4fee\u6539\u6587\u4ef6\u5939\u540d\u5b57 -&gt; \u542f\u52a8prometheus<\/p>\n<p><span class=\"token function\">tar<\/span> xf prometheus-2.40.1.linux-amd64.tar.gz <span class=\"token parameter variable\">-C<\/span> \/usr\/local\/  <\/p>\n<p><span class=\"token function\">mv<\/span> \/usr\/local\/prometheus-2.40.1.linux-amd64\/ \/usr\/local\/prometheus<\/p>\n<p>\/usr\/local\/prometheus\/prometheus <span class=\"token parameter variable\">&#8211;config.file<\/span><span class=\"token operator\">=<\/span><span class=\"token string\">\\&#8221;\/usr\/local\/prometheus\/prometheus.yml\\&#8221;<\/span> <span class=\"token operator\">&amp;<\/span><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418113205-6802383510ce7.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\"><\/p>\n<p>\u68c0\u67e5prometheus\u76d1\u542c\u662f\u5426\u6b63\u5e38\uff0c\u9ed8\u8ba4\u7aef\u53e39090<\/p>\n<p><span class=\"token function\">netstat<\/span> <span class=\"token parameter variable\">-an<\/span> <span class=\"token operator\">|<\/span><span class=\"token function\">grep<\/span> <span class=\"token number\">9090<\/span><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418113205-6802383522c6e.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\"><\/p>\n<h3>1.3\u4e3b\u673a\u6570\u636e\u5c55\u793a<\/h3>\n<p>\u901a\u8fc7http:\/\/192.168.0.123:9090\/\u8bbf\u95eeprometheus <img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418113205-680238352f20f.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\"><\/p>\n<p>\u9ed8\u8ba4\u53ef\u4ee5\u67e5\u770b\u5230\u5df2\u76d1\u63a7\u672c\u673a \u83dc\u5355Status -&gt; Targets <img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418113205-68023835421c9.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\"> <img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418113205-680238355630c.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\"><\/p>\n<p>\u901a\u8fc7\u6d4f\u89c8\u5668\u8bbf\u95eehttp:\/\/192.168.0.123:9090\/metrics\u53ef\u4ee5\u67e5\u770b\u76d1\u63a7\u6570\u636e <img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418113205-68023835684dd.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\"><\/p>\n<p>\u5728WEB\u754c\u9762\u9996\u9875\u53ef\u4ee5\u901a\u8fc7\u5173\u952e\u5b57\u641c\u7d22\u67e5\u8be2\u76d1\u63a7\u9879 <img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418113205-680238357f1ac.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\"><\/p>\n<h2>2.Grafana\u5b89\u88c5\u90e8\u7f72<\/h2>\n<p>Grafana\u662f\u4e00\u4e2a\u5f00\u6e90\u7684\u5ea6\u91cf\u5206\u6790\u548c\u53ef\u89c6\u5316\u5de5\u5177\uff0c\u53ef\u4ee5\u901a\u8fc7\u5c06\u91c7\u96c6\u7684\u6570\u636e\u5206\u6790\uff0c\u67e5\u8be2\uff0c\u7136\u540e\u8fdb\u884c\u53ef\u89c6\u5316\u7684\u5c55\u793a,\u5e76\u80fd\u5b9e\u73b0\u62a5\u8b66<\/p>\n<p>\u5b98\u7f51\uff1ahttps:\/\/grafana.com\/<\/p>\n<h3>2.1\u90e8\u7f72Grafana<\/h3>\n<p>\u4e0b\u8f7d\u5b89\u88c5\u5305\uff1a \u5730\u5740\uff1a https:\/\/dl.grafana.com\/enterprise\/release\/grafana-enterprise-9.2.4-1.x86_64.rpm<\/p>\n<p>\u4e0a\u4f20\u5b89\u88c5\u5305\uff1a \u5c06grafana-enterprise-9.2.4-1.x86_64.rpm\u5b89\u88c5\u5305\u4e0a\u4f20\u81f3192.168.0.124\u670d\u52a1\u5668 <img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418113205-68023835932ae.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\"><\/p>\n<p>\u5b89\u88c5grafana\uff1a \u8fdb\u5165\u5b89\u88c5\u5305\u6240\u5728\u76ee\u5f55\uff0c\u6267\u884c\u547d\u4ee4rpm -ivh grafana-enterprise-9.2.4-1.x86_64.rpm\u5b8c\u6210grafana\u5b89\u88c5 <img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418113205-68023835a64b3.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\"> \u6ce8\u610f\uff01\u5b89\u88c5\u8fc7\u7a0b\u6709\u53ef\u80fd\u4f1a\u63d0\u793a\u7f3a\u5c11\u4f9d\u8d56\u5305\uff0c\u5982\u679c\u62a5\u9519\u5219\u9700\u8981\u5148\u914d\u7f6eyum\u6e90\u5c06\u76f8\u5173\u4f9d\u8d56\u5305\u5b89\u88c5\u4e0a\u518d\u7ee7\u7eed\u5b89\u88c5grafana-enterprise-9.2.4-1.x86_64.rpm<\/p>\n<p>yum <span class=\"token function\">install<\/span> fontconfig<br \/>\nyum <span class=\"token function\">install<\/span> urw-fonts<br \/>\n<span class=\"token function\">rpm<\/span> <span class=\"token parameter variable\">-ivh<\/span> grafana-enterprise-9.2.4-1.x86_64.rpm<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418113205-68023835b35c9.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\"><\/p>\n<p>\u542f\u52a8grafana\uff1a \u6267\u884c\u547d\u4ee4\uff1a systemctl start grafana-server \u542f\u52a8grafana\u670d\u52a1 systemctl enable grafana-server \u5f00\u673a\u81ea\u52a8\u542f\u52a8grafana <img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418113205-68023835c0525.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\">\u68c0\u67e5grafana\u76d1\u542c\u662f\u5426\u6b63\u5e38\uff0c\u9ed8\u8ba4\u7aef\u53e33000<\/p>\n<p><span class=\"token function\">netstat<\/span> <span class=\"token parameter variable\">-an<\/span> <span class=\"token operator\">|<\/span><span class=\"token function\">grep<\/span> <span class=\"token number\">3000<\/span><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418113205-68023835cbc91.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\"><\/p>\n<h3>2.2\u914d\u7f6eGrafana\u6570\u636e\u6e90<\/h3>\n<p>\u901a\u8fc7\u6d4f\u89c8\u5668\u8bbf\u95ee http:\/\/192.168.0.124:3000\/\u5c31\u5230\u4e86\u767b\u5f55\u754c\u9762,\u4f7f\u7528\u9ed8\u8ba4\u7684admin\u7528\u6237,admin\u5bc6\u7801\u767b\u9646\u3002\u767b\u5f55\u540e\u9700\u8981\u4fee\u6539\u9ed8\u8ba4\u5bc6\u7801 <img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418113205-68023835d74f8.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\"><\/p>\n<p>\u767b\u5f55\u540e\u628aprometheus\u670d\u52a1\u5668\u6536\u96c6\u7684\u6570\u636e\u4f5c\u4e3a\u4e00\u4e2a\u6570\u636e\u6e90\u6dfb\u52a0\u5230grafana\uff0c\u8ba9grafana\u53ef\u4ee5\u5f97\u5230prometheus\u7684\u6570\u636e<\/p>\n<p>\uff081\uff09\u4ece\u5de6\u4fa7\u5bfc\u822a\u680f\u627e\u5230Data sources\u83dc\u5355 <img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418113205-68023835ee69f.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\"> \uff082\uff09\u8fdb\u5165\u83dc\u5355\u540e\u70b9\u51fb\u589e\u52a0\u6570\u636e\u6e90\uff0c\u6570\u636e\u6e90\u9009\u62e9prometheus <img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418113206-680238360fb41.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\"> <img decoding=\"async\" src=\"2025-04-185gqdtxdckbr.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\"><\/p>\n<p>\uff083\uff09\u8fdb\u5165prometheus\u914d\u7f6e\u540e\u6709\u4e24\u4e2a\u5fc5\u586b\u7684\u914d\u7f6e\uff0c\u5206\u522b\u662f\u6570\u636e\u6e90\u540d\u79f0\u548cprometheus\u7684\u8bbf\u95ee\u5730\u5740\uff0cprometheus\u7684ip\u548c\u7aef\u53e3\u3002\u914d\u7f6e\u5b8c\u6210\u540e\u5728\u9875\u9762\u6700\u4e0b\u65b9\u70b9\u51fbSave &amp; test\u4fdd\u5b58 <img decoding=\"async\" src=\"2025-04-18t42r31jgfxi.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\"><img decoding=\"async\" src=\"2025-04-184vekrfygv2r.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\"><\/p>\n<h3>2.2\u914d\u7f6eGrafana\u4eea\u8868\u677f<\/h3>\n<p>\u914d\u7f6e\u5b8c\u6570\u636e\u6e90\u540e\uff0cgrafana\u63a5\u6536\u5230prometheus\u7684\u6570\u636e\u9700\u8981\u4f7f\u7528\u4eea\u8868\u677f\u5c55\u793a\uff0c\u4eea\u8868\u677f\u53ef\u81ea\u5b9a\u4e49\u6216\u5bfc\u5165\u6a21\u677f\uff0cgrafana\u5b98\u7f51\u4e5f\u6709\u975e\u5e38\u591a\u7c7b\u578b\u7684\u6a21\u677f\u4f9b\u4e0b\u8f7d<\/p>\n<p>\uff081\uff09\u4ece\u5de6\u4fa7\u5bfc\u822a\u680f\u627e\u5230\u65b0\u5efa\u4eea\u8868\u677f\uff0c\u9009\u62e9\u6dfb\u52a0\u4e00\u4e2a\u9762\u677f <img decoding=\"async\" src=\"2025-04-18vp1uhstfrq2.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\"> <img decoding=\"async\" src=\"2025-04-18mluwiogieeh.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\"><\/p>\n<p>\uff082\uff09\u8fdb\u5165\u65b0\u5efa\u9762\u677f\u540e\u9009\u62e9prometheus\u6570\u636e\u6e90\uff0c\u9700\u8981\u5c55\u793a\u7684\u6570\u636e\u9879\u5728Metric\u91cc\u9009\u62e9\uff0c\u914d\u7f6e\u5b8c\u6210\u540e\u53ef\u5728\u9762\u677f\u770b\u5230\u6570\u636e\u5c55\u793a <img decoding=\"async\" src=\"2025-04-18cgxe1nxpsif.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\"><\/p>\n<p>\uff083\uff09\u5bfc\u5165\u6a21\u677f\u65b9\u5f0f\uff0c\u4ece\u5de6\u4fa7\u5bfc\u822a\u680f\u627e\u5230\u5bfc\u5165\uff0c\u5bfc\u5165\u6a21\u677f\u53ef\u672c\u5730\u4e0a\u4f20\u6216\u8005\u76f4\u63a5\u4ece\u5b98\u7f51\u4e0b\u8f7d\u5bfc\u5165\uff08\u8f93\u5165\u6a21\u677f\u7684ID\u6216\u5b8c\u6574\u7684\u94fe\u63a5\uff0c\u4f46\u9700\u8981\u6709\u4e92\u8054\u7f51\uff09\uff0c\u4ee5\u4e0b\u5c31\u662f\u6a21\u677f\u7684\u5b8c\u6574\u94fe\u63a5\uff0c\u6807\u7ea2\u7684\u4e3a\u6a21\u677fID\u3002<\/p>\n<p>https:\/\/grafana.com\/grafana\/dashboards\/7362-mysql-overview\/?tab=revisions <img decoding=\"async\" src=\"2025-04-18osvlhoiczbs.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\"><img decoding=\"async\" src=\"2025-04-18sr4gyqcu52z.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\"><\/p>\n<p>\u4f7f\u7528\u4e24\u79cd\u65b9\u5f0f\u7684\u5176\u4e2d\u4e00\u79cd\u5bfc\u5165\u6a21\u677f\u540e\u5c31\u4f1a\u51fa\u73b0\u4ee5\u4e0b\u754c\u9762\uff0c\u8fd9\u91cc\u6f14\u793a\u6a21\u677f\u540d\u79f0\u548c\u6587\u4ef6\u5939\u90fd\u4e3a\u9ed8\u8ba4\uff0c\u6570\u636e\u6e90\u5c31\u9009\u62e92.2\u7ae0\u8282\u914d\u7f6e\u7684prometheus\uff0c\u7136\u540e\u5bfc\u5165<\/p>\n<p><img decoding=\"async\" src=\"2025-04-18ibaqgnyjexz.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\"><\/p>\n<p>\u4ece\u5de6\u4fa7\u5bfc\u822a\u680f\u627e\u5230Browse\uff0c\u8fdb\u5165\u540e\u5373\u53ef\u627e\u5230\u521a\u521a\u5bfc\u5165\u7684\u6a21\u677f <img decoding=\"async\" src=\"2025-04-18cpr04amfc5w.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\"><\/p>\n<p>\u70b9\u51fb\u8be5\u6a21\u677f\u53ef\u4ee5\u67e5\u770b\u4eea\u8868\u677f\u6548\u679c\uff0c\u56e0\u4e3a\u672c\u7ae0\u8282\u4ec5\u6f14\u793a\u6a21\u677f\u5bfc\u5165\uff0c\u6ca1\u6709\u914d\u7f6e\u5bf9\u5e94\u6570\u636e\u6e90\uff0c\u6240\u4ee5\u4eea\u8868\u677f\u6709\u6ca1\u6709\u6570\u636e\u5c55\u793a <img decoding=\"async\" src=\"2025-04-18w2qukm2bver.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\"><\/p>\n<p>\u4eea\u8868\u677f\u6a21\u677f\u53ef\u4ee5\u5728\u4ee5\u4e0b\u5730\u5740\u4e0b\u8f7d https:\/\/grafana.com\/grafana\/dashboards\/<\/p>\n<h2>3.AlertManager\u5b89\u88c5\u90e8\u7f72<\/h2>\n<h3>3.1\u90e8\u7f72alertmanager<\/h3>\n<p>Alertmanager\u662f\u4e00\u4e2a\u72ec\u7acb\u7684\u544a\u8b66\u6a21\u5757\uff0c\u63a5\u6536Prometheus\u7b49\u5ba2\u6237\u7aef\u53d1\u6765\u7684\u8b66\u62a5\uff0c\u4e4b\u540e\u901a\u8fc7\u5206\u7ec4\u3001\u5220\u9664\u91cd\u590d\u7b49\u5904\u7406\uff0c\u5e76\u5c06\u5b83\u4eec\u901a\u8fc7\u8def\u7531\u53d1\u9001\u7ed9\u6b63\u786e\u7684\u63a5\u6536\u5668\uff1b\u544a\u8b66\u65b9\u5f0f\u53ef\u4ee5\u6309\u7167\u4e0d\u540c\u7684\u89c4\u5219\u53d1\u9001\u7ed9\u4e0d\u540c\u7684\u6a21\u5757\u8d1f\u8d23\u4eba\uff0cAlertmanager\u652f\u6301Email, Slack\uff0c\u7b49\u544a\u8b66\u65b9\u5f0f, \u4e5f\u53ef\u4ee5\u901a\u8fc7webhook\u63a5\u5165\u9489\u9489\u7b49\u56fd\u5185IM\u5de5\u5177\u3002<\/p>\n<p>\u4e0b\u8f7d\u5b89\u88c5\u5305\uff1a \u5730\u5740\uff1ahttps:\/\/prometheus.io\/download\/#alertmanager<\/p>\n<p>\u6309\u64cd\u4f5c\u7cfb\u7edf\u7c7b\u578b\u9009\u62e9\u9700\u8981\u7684\u5b89\u88c5\u5305 <img decoding=\"async\" src=\"2025-04-18biirppwreol.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\"> \u4e0a\u4f20\u5b89\u88c5\u5305\uff1a \u5c06alertmanager-0.24.0.linux-amd64.tar.gz\u5b89\u88c5\u5305\u4e0a\u4f20\u81f3192.168.0.123\u670d\u52a1\u5668 <img decoding=\"async\" src=\"2025-04-18e43muyg1rfj.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\"> \u5b89\u88c5alertmanager\uff1a \u8fdb\u5165\u5b89\u88c5\u5305\u6240\u5728\u76ee\u5f55\uff0c\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\u5b8c\u6210alertmanager\u90e8\u7f72<\/p>\n<p><span class=\"token function\">tar<\/span> zxf alertmanager-0.24.0.linux-amd64.tar.gz <span class=\"token parameter variable\">-C<\/span> \/usr\/local\/<br \/>\n<span class=\"token function\">mv<\/span> \/usr\/local\/alertmanager-0.24.0.linux-amd64\/ \/usr\/local\/alertmanager<\/p>\n<p><img decoding=\"async\" src=\"2025-04-18unbr24zs2xq.png\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\"><\/p>\n<h3>3.2\u544a\u8b66\u90ae\u4ef6\u53d1\u9001\u914d\u7f6e<\/h3>\n<p>\u7f16\u8f91alertamanger\u914d\u7f6e\u6587\u4ef6\uff1a<\/p>\n<p><span class=\"token function\">vim<\/span> \/usr\/local\/alertmanager\/alertmanager.yml<\/p>\n<p>global:<br \/>\n  smtp_smarthost: <span class=\"token string\">\\&#8217;smtp.xxx.com:25\\&#8217;<\/span>   <span class=\"token comment\">#\u544a\u8b66\u90ae\u4ef6\u53d1\u9001\u8005SMTP\u5730\u5740<\/span><br \/>\n  smtp_from: <span class=\"token string\">\\&#8217;xxx@163.com\\&#8217;<\/span>   <span class=\"token comment\">#\u53d1\u4ef6\u8005\u90ae\u7bb1<\/span><br \/>\n  smtp_auth_username: <span class=\"token string\">\\&#8217;xxx@163.com\\&#8217;<\/span>  <span class=\"token comment\">#\u90ae\u7bb1\u8d26\u53f7<\/span><br \/>\n  smtp_auth_password:<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb4.2k\u6b21\uff0c\u70b9\u8d5e24\u6b21\uff0c\u6536\u85cf39\u6b21\u3002\u9996\u5148\u5728Alertmanager\u4e3b\u76ee\u5f55\u4e0b\u521b\u5efa\u4e00\u4e2atemplates\u6587\u4ef6\u5939\uff0c\u7528\u6237\u5b58\u653e\u6a21\u677f\u6587\u4ef6\uff0c\u7136\u540e\u521b\u5efa\u4e00\u4e2aemail.tmpl\u6587\u4ef6\uff0c\u5199\u5165\u4ee5\u4e0b\u5185\u5bb9======== \u5f02\u5e38\u544a\u8b66 ======== \u544a\u8b66\u540d\u79f0\uff1a{{ $alert.Labels.alertname }} \u544a\u8b66\u7ea7\u522b\uff1a{{ $alert.Labels.severity }} \u7ea7 \u544a\u8b66\u673a\u5668\uff1a{{ $alert.Labels.instance }} {{ $alert.Labels.device }} _prometheus\u5b89\u88c5\u90e8\u7f72<\/p>\n","protected":false},"author":2,"featured_media":12369,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[58,678,100,43,44],"topic":[],"class_list":["post-12389","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-linux","tag-prometheus","tag-100","tag-43","tag-44"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Prometheus\u5b89\u88c5\u90e8\u7f72 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/12389.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Prometheus\u5b89\u88c5\u90e8\u7f72 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb4.2k\u6b21\uff0c\u70b9\u8d5e24\u6b21\uff0c\u6536\u85cf39\u6b21\u3002\u9996\u5148\u5728Alertmanager\u4e3b\u76ee\u5f55\u4e0b\u521b\u5efa\u4e00\u4e2atemplates\u6587\u4ef6\u5939\uff0c\u7528\u6237\u5b58\u653e\u6a21\u677f\u6587\u4ef6\uff0c\u7136\u540e\u521b\u5efa\u4e00\u4e2aemail.tmpl\u6587\u4ef6\uff0c\u5199\u5165\u4ee5\u4e0b\u5185\u5bb9======== \u5f02\u5e38\u544a\u8b66 ======== \u544a\u8b66\u540d\u79f0\uff1a{{ $alert.Labels.alertname }} \u544a\u8b66\u7ea7\u522b\uff1a{{ $alert.Labels.severity }} \u7ea7 \u544a\u8b66\u673a\u5668\uff1a{{ $alert.Labels.instance }} {{ $alert.Labels.device }} _prometheus\u5b89\u88c5\u90e8\u7f72\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/12389.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2025-04-18T11:32:07+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418113204-68023834b1a0f.png\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/12389.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/12389.html\",\"name\":\"Prometheus\u5b89\u88c5\u90e8\u7f72 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2025-04-18T11:32:07+00:00\",\"dateModified\":\"2025-04-18T11:32:07+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/12389.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/12389.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/12389.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Prometheus\u5b89\u88c5\u90e8\u7f72\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Prometheus\u5b89\u88c5\u90e8\u7f72 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/12389.html","og_locale":"zh_CN","og_type":"article","og_title":"Prometheus\u5b89\u88c5\u90e8\u7f72 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb4.2k\u6b21\uff0c\u70b9\u8d5e24\u6b21\uff0c\u6536\u85cf39\u6b21\u3002\u9996\u5148\u5728Alertmanager\u4e3b\u76ee\u5f55\u4e0b\u521b\u5efa\u4e00\u4e2atemplates\u6587\u4ef6\u5939\uff0c\u7528\u6237\u5b58\u653e\u6a21\u677f\u6587\u4ef6\uff0c\u7136\u540e\u521b\u5efa\u4e00\u4e2aemail.tmpl\u6587\u4ef6\uff0c\u5199\u5165\u4ee5\u4e0b\u5185\u5bb9======== \u5f02\u5e38\u544a\u8b66 ======== \u544a\u8b66\u540d\u79f0\uff1a{{ $alert.Labels.alertname }} \u544a\u8b66\u7ea7\u522b\uff1a{{ $alert.Labels.severity }} \u7ea7 \u544a\u8b66\u673a\u5668\uff1a{{ $alert.Labels.instance }} {{ $alert.Labels.device }} _prometheus\u5b89\u88c5\u90e8\u7f72","og_url":"https:\/\/www.wsisp.com\/helps\/12389.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2025-04-18T11:32:07+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2025\/04\/20250418113204-68023834b1a0f.png"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"1 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/12389.html","url":"https:\/\/www.wsisp.com\/helps\/12389.html","name":"Prometheus\u5b89\u88c5\u90e8\u7f72 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2025-04-18T11:32:07+00:00","dateModified":"2025-04-18T11:32:07+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/12389.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/12389.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/12389.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"Prometheus\u5b89\u88c5\u90e8\u7f72"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/12389","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=12389"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/12389\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/12369"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=12389"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=12389"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=12389"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=12389"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}