{"id":312250,"date":"2020-10-29T15:01:10","date_gmt":"2020-10-29T15:01:10","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=312250"},"modified":"-0001-11-30T00:00:00","modified_gmt":"2020-10-29T15:01:10","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=312250","title":{"rendered":"Kubernetes: \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433 c \u043f\u043e\u043c\u043e\u0449\u044c\u044e Prometheus"},"content":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/ke\/vw\/wi\/kevwwicwhh_ginf9fqaidqpvccq.jpeg\"><\/p>\n<p>\u0412 \u044d\u0442\u043e\u0438\u0306 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u043f\u043e\u0441\u0442\u0430\u0440\u0430\u043b\u0441\u044f \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c, \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c Prometheus \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433\u0430 \u0434\u043b\u044f \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u043d\u043e\u0438\u0306 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u044b. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043b \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0443 Prometheus \u0438 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0438\u0306\u0441\u0442\u0432\u0438\u0435 \u0435\u0433\u043e \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432. \u041e\u0431\u043e\u0437\u043d\u0430\u0447\u0438\u043b \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0435 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a\u0438 \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u0447\u0435\u043c\u0443 \u044d\u0442\u0430 \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0430 \u0442\u0430\u043a\u043e\u0435 \u0448\u0438\u0440\u043e\u043a\u043e\u0435 \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0432 \u0441\u0440\u0435\u0434\u0430\u0445 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0438\u0445 \u043a\u043e\u043d\u0442\u0435\u0438\u0306\u043d\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u044e. \u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0430\u044e \u0441\u0440\u0430\u0437\u0443: \u0441\u0442\u0430\u0442\u044c\u044f \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0430\u0441\u044c \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043e\u0431\u044a\u0435\u043c\u043d\u043e\u0439. \u042d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u0441\u044f \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043b\u0435\u0437\u043d\u0430 \u0434\u043b\u044f \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0449\u0438\u0445 DevOps \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u0438\u0441\u0442\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043b\u0430\u043d\u0438\u0440\u0443\u044e\u0442 \u0438\u043b\u0438 \u0443\u0436\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u0432 \u0441\u0432\u043e\u0435\u0438\u0306 \u0440\u0430\u0431\u043e\u0442\u0435 Docker, Kubernetes. \u0418\u0442\u0430\u043a, \u043d\u0430\u0447\u043d\u0435\u043c!  <\/p>\n<p>  <a name=\"habracut\"><\/a>  <\/p>\n<h3>\u0427\u0442\u043e \u0442\u0430\u043a\u043e\u0435 Prometheus?<\/h3>\n<p>  <\/p>\n<p>Prometheus \u2014 \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433\u0430, \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u043d\u0430\u044f \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u0434\u043b\u044f \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438 \u0438\u0437\u043c\u0435\u043d\u044f\u044e\u0449\u0435\u0439\u0441\u044f \u0441\u0440\u0435\u0434\u044b. \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u043e\u043d\u0430 \u043c\u043e\u0436\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0434\u043b\u044f \u0442\u0440\u0430\u0434\u0438\u0446\u0438\u043e\u043d\u043d\u043e\u0439 \u0438\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043d\u0430 \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0441\u0435\u0440\u0432\u0435\u0440\u0430\u0445 \u0441 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\u043c\u0438, \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442\u044b\u043c\u0438 \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043d\u0430 \u041e\u0421. \u041d\u0430 \u0441\u0435\u0433\u043e\u0434\u043d\u044f\u0448\u043d\u0438\u0439 \u0434\u0435\u043d\u044c Prometheus \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442 \u043b\u0438\u0434\u0438\u0440\u0443\u044e\u0449\u0443\u044e \u043f\u043e\u0437\u0438\u0446\u0438\u044e \u0441\u0440\u0435\u0434\u0438 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432, \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u043c\u044b\u0445 \u0432 \u043c\u0438\u0440\u0435 \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432. \u0427\u0442\u043e\u0431\u044b \u043f\u043e\u043d\u044f\u0442\u044c, \u043f\u043e\u0447\u0435\u043c\u0443 Prometheus \u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0442\u0430\u043a\u043e\u0439 \u043f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u043e\u0441\u0442\u044c\u044e, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432.   <\/p>\n<p>  <\/p>\n<p>\u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0441\u0440\u0435\u0434\u044b \u0434\u043b\u044f \u0440\u0430\u0437\u0432\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u043d\u0438\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c Kubernetes.  <\/p>\n<p>  <\/p>\n<p>\u0426\u0435\u043b\u044c \u2014 \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0432 Prometheus \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433 \u0434\u043b\u044f Redis-\u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430 \u0432 Kubernetes. \u0413\u0440\u0430\u0444\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u2014 Grafana. \u0414\u043b\u044f \u043e\u043f\u043e\u0432\u0435\u0449\u0435\u043d\u0438\u044f \u0437\u0430\u0434\u0435\u0439\u0441\u0442\u0432\u0443\u0435\u043c email \u0438 Slack.  <\/p>\n<p>  <\/p>\n<h3>\u041e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b Prometheus<\/h3>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/n3\/5p\/0h\/n35p0hcv46xmlyn3x9vpoe4cuyk.png\">&quot;   <\/p>\n<p>\u0412 \u0446\u0435\u043d\u0442\u0440\u0435 Prometheus \u2014 \u0441\u0435\u0440\u0432\u0435\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0443 \u043f\u043e \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433\u0443. \u041e\u043d \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0445 \u0447\u0430\u0441\u0442\u0435\u0439:  <\/p>\n<p>  <\/p>\n<ul>\n<li><b>Time Series Data Base (TSDB)<\/b> \u2014 \u0431\u0430\u0437\u0430 \u0434\u0430\u043d\u043d\u044b\u0445, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f \u043c\u0435\u0442\u0440\u0438\u043a\u0438, \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0435 \u043e\u0442 \u0446\u0435\u043b\u0435\u0432\u044b\u0445 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, CPU usage, Memory utilization \u0438\u043b\u0438 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043a \u0441\u0435\u0440\u0432\u0438\u0441\u0443 <\/li>\n<\/ul>\n<p>  <\/p>\n<ul>\n<li> <b>Retrieval worker<\/b> \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0437\u0430 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u044d\u0442\u0438\u0445 \u043c\u0435\u0442\u0440\u0438\u043a \u0441 \u0446\u0435\u043b\u0435\u0432\u044b\u0445 \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u0432 \u0438 \u0440\u0430\u0437\u043c\u0435\u0449\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0432 TSDB<\/li>\n<\/ul>\n<p>  <\/p>\n<ul>\n<li> <b>HTTP server<\/b> \u2014 API \u0434\u043b\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043a \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u043d\u044b\u043c \u0432 TSDB \u0434\u0430\u043d\u043d\u044b\u043c. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0430 \u0434\u0430\u0448\u0431\u043e\u0440\u0434\u0435 \u0432 Prometheus \u0438\u043b\u0438 \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u0445 \u0441\u0438\u0441\u0442\u0435\u043c\u0430\u0445 \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u2014 \u0442\u0430\u043a\u0438\u0445, \u043a\u0430\u043a Grafana.<\/li>\n<\/ul>\n<p>  <\/p>\n<h3>\u041e\u0442 \u0442\u0435\u043e\u0440\u0438\u0438 \u043a \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435<\/h3>\n<p>  <\/p>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0435\u043c \u043d\u0430\u0448 \u0441\u0435\u0440\u0432\u0435\u0440 Prometheus \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043f\u0430\u043a\u0435\u0442\u043d\u043e\u0433\u043e \u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440\u0430 Helm.  <\/p>\n<p>  <b>\u0418\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0430 \u0434\u043b\u044f \u0438\u043d\u0436\u0435\u043d\u0435\u0440\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u043c\u0435\u044e\u0442 \u0431\u0430\u0437\u043e\u0432\u044b\u0435 \u043d\u0430\u0432\u044b\u043a\u0438 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 Kubernetes \u0438 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0446\u0435\u043b\u044f\u0445. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0432 \u043f\u0440\u043e\u0434\u0430\u043a\u0448\u0435\u043d \u0434\u0430\u043d\u043d\u043e\u0439 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u043a\u0440\u0430\u0439\u043d\u0435 \u043d\u0435 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u0442\u0441\u044f.<\/b><\/p>\n<p>\u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u044e\u0442\u0441\u044f \u0440\u0430\u0431\u043e\u0447\u0438\u0439 \u043a\u043b\u0430\u0441\u0442\u0435\u0440 Kubernetes \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0439 kubectl. \u041c\u043e\u0436\u043d\u043e \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u043b\u0430\u0441\u0442\u0435\u0440 Kubernetes \u0432<a href=\"https:\/\/mcs.mail.ru\/containers\/\"> MCS<\/a>. \u0421\u0435\u0440\u0432\u0435\u0440 Prometheus \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e:  <\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">#\u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 helm repo add stable https:\/\/kubernetes-charts.storage.googleapis.com #\u041e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u043c helm repo update #\u0421\u043e\u0437\u0434\u0430\u0435\u043c namespace kubectl create namespace monitoring #\u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c helm c \u0438\u043c\u0435\u043d\u0435\u043c my-prometheus helm install my-prometheus stable\/prometheus -n monitoring <\/code><\/pre>\n<p>  <\/p>\n<p>\u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c:  <\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">The Prometheus PushGateway can be accessed via port 9091 on the following DNS name from within your cluster: my-prometheus-pushgateway.monitoring.svc.cluster.local  Get the PushGateway URL by running these commands in the same shell:   export POD_NAME=$(kubectl get pods --namespace monitoring -l &quot;app=prometheus,component=pushgateway&quot; -o jsonpath=&quot;{.items[0].metadata.name}&quot;)   kubectl --namespace monitoring port-forward $POD_NAME 9091  For more information on running Prometheus, visit: https:\/\/prometheus.io\/ <\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u0432\u0441\u0435 \u043b\u0438 \u043f\u043e\u0434\u044b \u0437\u0430\u043f\u0443\u0449\u0435\u043d\u044b:  <\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">kubectl get pods -n monitoring NAME                                               READY   STATUS    RESTARTS   AGE my-prometheus-alertmanager-86986878b5-5w2vw        2\/2     Running   0          76s my-prometheus-kube-state-metrics-dc694d6d7-xk85n   1\/1     Running   0          76s my-prometheus-node-exporter-grgqw                  1\/1     Running   0          76s my-prometheus-node-exporter-njksq                  1\/1     Running   0          76s my-prometheus-node-exporter-pcmgv                  1\/1     Running   0          76s my-prometheus-pushgateway-6694855f-n6xwt           1\/1     Running   0          76s my-prometheus-server-77ff45bc6-shrmd               2\/2     Running   0          76s <\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u0440\u0438 \u0432\u044b\u0432\u043e\u0434\u0435 Helm chart \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c port-forward \u0434\u043b\u044f pushgateway, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0443 Prometheus. \u041c\u0435\u043d\u044f\u0435\u043c component \u043d\u0430 server \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u043c:  <\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">#\u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043d\u0430\u0437\u0432\u0430\u043d\u0438\u0435 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430 \u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c \u0435\u0433\u043e \u0432 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e POD_NAME export POD_NAME=$(kubectl get pods --namespace monitoring -l &quot;app=prometheus,component=server&quot; -o jsonpath=&quot;{.items[0].metadata.name}&quot;) #\u043f\u0440\u043e\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0435\u043c \u043f\u043e\u0440\u0442 kubectl --namespace monitoring port-forward $POD_NAME 9090 <\/code><\/pre>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c<a href=\"http:\/\/127.0.0.1:9090\/\"> http:\/\/127.0.0.1:9090\/<\/a> \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435 \u2014 \u0438 \u0432\u0438\u0434\u0438\u043c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 Prometheus:  <\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/ey\/fe\/y-\/eyfey-rabjwifvwmlcw7cd7fgtg.png\">  <\/p>\n<p>\u0418\u0442\u0430\u043a, \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0441\u0435\u0440\u0432\u0435\u0440 Prometheus, \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442\u044b\u0439 \u0432\u043d\u0443\u0442\u0440\u0438 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430 Kubernetes. \u0422\u0435\u043f\u0435\u0440\u044c \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0435\u043c Redis, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u043f\u043e\u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u0438 \u0438 \u043f\u043e\u0441\u0442\u0430\u0432\u0438\u043c \u043d\u0430 \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433 \u0432 Prometheus. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0442\u0430\u043a\u0436\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c Helm:  <\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">#\u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 helm repo add bitnami https:\/\/charts.bitnami.com\/bitnami #\u041e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u043c helm repo update #\u0421\u043e\u0437\u0434\u0430\u0435\u043c namespace kubectl create namespace redis #\u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c helm c \u0438\u043c\u0435\u043d\u0435\u043c redis helm install redis bitnami\/redis -n redis --set cluster.enabled=true --set cluster.slaveCount=2 --set master.persistence.enabled=false --set slave.persistence.enabled=false <\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b <b>cluster.enabled<\/b> \u0438<b> cluster.slaveCount <\/b>\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044e\u0442, \u0447\u0442\u043e Redis \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442 \u0432 \u0440\u0435\u0436\u0438\u043c\u0435 \u00ab\u043a\u043b\u0430\u0441\u0442\u0435\u0440\u00bb, \u0438 \u0432 \u044d\u0442\u043e\u043c \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0435 \u0434\u0432\u0430 \u043f\u043e\u0434\u0430 \u0431\u0443\u0434\u0443\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043a\u0430\u043a slave. \u0412 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u0445 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c: \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c persistent volume \u0434\u043b\u044f master \u0438 slave (persistence.enabled=false). \u0421\u0435\u0439\u0447\u0430\u0441 \u044d\u0442\u043e \u043d\u0443\u0436\u043d\u043e, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u043e\u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0443 Redis. \u0412 \u043f\u0440\u043e\u0434\u0430\u043a\u0448\u0435\u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0443 persistent volume.  <\/p>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u0447\u0442\u043e \u0432\u0441\u0435 \u043f\u043e\u0434\u044b redis \u0437\u0430\u043f\u0443\u0449\u0435\u043d\u044b:  <\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">kubectl get pod -n redis  NAME             READY   STATUS    RESTARTS   AGE redis-master-0   1\/1     Running   0          65s redis-slave-0    1\/1     Running   0          65s redis-slave-1    1\/1     Running   0          28s <\/code><\/pre>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c, \u043a\u043e\u0433\u0434\u0430 \u0443 \u043d\u0430\u0441 \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442\u044b Prometheus \u0438 Redis, \u043d\u0443\u0436\u043d\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0438\u0445 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435.  <\/p>\n<h3>Targets \u0438 metrics<\/h3>\n<p>  <\/p>\n<p>Prometheus-\u0441\u0435\u0440\u0432\u0435\u0440 \u043c\u043e\u0436\u0435\u0442 \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u0442\u044c \u0441\u0430\u043c\u044b\u0435 \u0440\u0430\u0437\u043d\u044b\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u2014 \u043a \u043f\u0440\u0438\u043c\u0435\u0440\u0443, Linux- \u0438 Windows-\u0441\u0435\u0440\u0432\u0435\u0440\u044b. \u042d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0431\u0430\u0437\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u043b\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u0441\u0432\u043e\u0435\u043c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0438. \u0422\u0430\u043a\u0438\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0432 Prometheus \u043d\u0430\u0437\u044b\u0432\u0430\u044e\u0442\u0441\u044f targets. \u041a\u0430\u0436\u0434\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 \u0438\u043c\u0435\u0435\u0442 \u0442\u0430\u043a \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u043c\u044b\u0435 \u0435\u0434\u0438\u043d\u0438\u0446\u044b \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433\u0430. \u0414\u043b\u044f Linux-\u0441\u0435\u0440\u0432\u0435\u0440\u0430 \u044d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0442\u0435\u043a\u0443\u0449\u0430\u044f \u0443\u0442\u0438\u043b\u0438\u0437\u0430\u0446\u0438\u044f CPU, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 memory \u0438 \u0434\u0438\u0441\u043a\u0430. \u0414\u043b\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u2014 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043e\u0448\u0438\u0431\u043e\u043a, \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u0438 \u0432\u0440\u0435\u043c\u044f \u0438\u0445 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f. \u042d\u0442\u0438 \u0435\u0434\u0438\u043d\u0438\u0446\u044b \u043d\u0430\u0437\u044b\u0432\u0430\u044e\u0442\u0441\u044f metrics \u0438 \u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f \u0432 TSDB.  <\/p>\n<h3>Exporters<\/h3>\n<p>  <\/p>\n<p>Prometheus \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u043c\u0435\u0442\u0440\u0438\u043a\u0438 \u0438\u0437 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0445 \u0432 \u0435\u0433\u043e \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u043e\u0432 \u0432 \u0431\u043b\u043e\u043a\u0435 targets. \u041d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u044b \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 \u043c\u0435\u0442\u0440\u0438\u043a\u0438 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 Prometheus, \u0438 \u0434\u043b\u044f \u0438\u0445 \u0441\u0431\u043e\u0440\u0430 \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u043d\u0438\u0447\u0435\u0433\u043e \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0442\u044c. \u0414\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c Prometheus \u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438, \u043a\u0430\u043a \u044d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u043d\u043e \u043d\u0438\u0436\u0435:  <\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\"> scrape_configs:      \u2014 job_name: prometheus        static_configs:          \u2014 targets:            \u2014 localhost:9090 <\/code><\/pre>\n<p>  <\/p>\n<p>\u0423\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u0441\u0435\u0440\u0432\u0435\u0440\u0443 Prometheus \u0437\u0430\u0431\u0438\u0440\u0430\u0442\u044c \u043c\u0435\u0442\u0440\u0438\u043a\u0438 \u0438\u0437 \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u0439 \u0442\u043e\u0447\u043a\u0438: localhost:9090\/metrics.  <\/p>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435 \u043c\u043e\u0433\u0443\u0442 \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u043c\u0435\u0442\u0440\u0438\u043a\u0438 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 Prometheus, \u043d\u0443\u0436\u043d\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 <b>exporters<\/b>. \u041e\u0431\u044b\u0447\u043d\u043e <b>exporters <\/b>\u2014 \u0441\u043a\u0440\u0438\u043f\u0442 \u0438\u043b\u0438 \u0441\u0435\u0440\u0432\u0438\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u043c\u0435\u0442\u0440\u0438\u043a\u0438 \u043e\u0442 \u0446\u0435\u043b\u0438, \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0438\u0440\u0443\u0435\u0442 \u0438\u0445 \u0444\u043e\u0440\u043c\u0430\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u00ab\u043f\u043e\u043d\u0438\u043c\u0430\u0435\u0442\u00bb Prometheus, \u0438 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u044d\u0442\u0438 \u0434\u0430\u043d\u043d\u044b\u0435 \u0441\u0435\u0440\u0432\u0435\u0440\u0443 \u043f\u043e \u043f\u0443\u0442\u0438 \/metrics. Prometheus \u0438\u043c\u0435\u0435\u0442 \u0431\u043e\u043b\u044c\u0448\u043e\u0439 <a href=\"https:\/\/prometheus.io\/docs\/instrumenting\/exporters\/\">\u043d\u0430\u0431\u043e\u0440 \u0433\u043e\u0442\u043e\u0432\u044b\u0445<\/a> exporters \u0434\u043b\u044f \u0440\u0430\u0437\u043d\u044b\u0445 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u2014 \u044d\u0442\u0438 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u044b \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043b\u044f HAProxy, Linux system, \u043e\u0431\u043b\u0430\u0447\u043d\u044b\u0445 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c \u0438 \u0434\u0440.  <\/p>\n<p>  <\/p>\n<h3>Redis \u0438 exporter<\/h3>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u043c <b>exporter<\/b> \u0434\u043b\u044f \u043d\u0430\u0448\u0435\u0433\u043e Redis-\u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430. \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0444\u0430\u0439\u043b values.yaml \u0441\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0435\u043c:  <\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">cluster:  enabled: true  slaveCount: 2   ## ## Redis Master parameters ## master:  persistence:    enabled: false  extraFlags:    \u2014 &quot;--maxmemory 256mb&quot;   slave:  persistence:    enabled: false  extraFlags:    \u2014 &quot;--maxmemory 256mb&quot;     ## Prometheus Exporter \/ Metrics ## metrics:  enabled: true    image:    registry: docker.io    repository: bitnami\/redis-exporter    tag: 1.4.0-debian-10-r3    pullPolicy: IfNotPresent    ## Metrics exporter pod Annotation and Labels  podAnnotations:    prometheus.io\/scrape: &quot;true&quot;    prometheus.io\/port: &quot;9121&quot; <\/code><\/pre>\n<p>  <\/p>\n<p>\u0417\u0434\u0435\u0441\u044c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438\u0441\u044c \u0432 \u043a\u043e\u043c\u0430\u043d\u0434\u043d\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0435 \u0434\u043b\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 Redis \u0432 \u0440\u0435\u0436\u0438\u043c\u0435 cluster, \u043f\u0435\u0440\u0435\u043d\u0435\u0441\u0435\u043d\u044b \u0432 yaml-\u0444\u0430\u0439\u043b. \u0414\u043b\u044f \u0441\u0431\u043e\u0440\u0430 \u043c\u0435\u0442\u0440\u0438\u043a \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 <b>redis-exporter.<\/b>  <\/p>\n<p>  <\/p>\n<p>\u041e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u043c Redis \u0441 \u043d\u043e\u0432\u044b\u043c\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438:  <\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">helm upgrade redis -f redis\/values.yaml bitnami\/redis -n redis <\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u0447\u0442\u043e \u043f\u043e\u0434\u044b Redis \u0437\u0430\u043f\u0443\u0449\u0435\u043d\u044b:  <\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">kubectl get pods -n redis redis-master-0   2\/2     Running   0          3m40s redis-slave-0    2\/2     Running   0          2m4s redis-slave-1    2\/2     Running   0          2m16s  <\/code><\/pre>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043a \u043a\u0430\u0436\u0434\u043e\u043c\u0443 pod \u00ab\u043f\u0440\u0438\u0432\u044f\u0437\u0430\u043d\u00bb \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440 <b>redis-exporter<\/b>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u043c\u0435\u0442\u0440\u0438\u043a\u0430\u043c Redis.  <\/p>\n<p>  <\/p>\n<p>\u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u0441\u043d\u044f\u0442\u0438\u0435 \u043c\u0435\u0442\u0440\u0438\u043a \u0434\u043b\u044f \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442\u044b\u0445 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u043e\u0432 redis-exporter \u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e Prometheus \u043d\u0435 \u043d\u0443\u0436\u043d\u043e, \u0442\u0430\u043a \u043a\u0430\u043a \u043e\u043d \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 <b>kubernetes_sd_configs <\/b>(\u043b\u0438\u0441\u0442\u0438\u043d\u0433 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d \u043d\u0438\u0436\u0435). \u0417\u0430 \u0441\u0447\u0451\u0442 \u044d\u0442\u043e\u0433\u043e \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438 \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0441\u0431\u043e\u0440 \u043c\u0435\u0442\u0440\u0438\u043a \u0434\u043b\u044f \u0432\u043d\u043e\u0432\u044c \u043f\u043e\u044f\u0432\u0438\u0432\u0448\u0438\u0445\u0441\u044f \u043f\u043e\u0434\u043e\u0432. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0435 \u043e\u0431 \u044d\u0442\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0432 <a href=\"https:\/\/prometheus.io\/docs\/prometheus\/latest\/configuration\/configuration\/#kubernetes_sd_config\">\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438<\/a>.  <\/p>\n<pre><code class=\"plaintext\">  \u2014 job_name: 'kubernetes-pods'        kubernetes_sd_configs:          \u2014 role: pod        relabel_configs:          \u2014 source_labels: [__meta_kubernetes_pod_annotation_prometheus_io_scrape]            action: keep            regex: true          \u2014 source_labels: [__meta_kubernetes_pod_annotation_prometheus_io_path]            action: replace            target_label: __metrics_path__            regex: (.+)          \u2014 source_labels: [__address__, __meta_kubernetes_pod_annotation_prometheus_io_port]            action: replace            regex: ([^:]+)(?::\\d+)?;(\\d+)            replacement: $1:$2            target_label: __address__          \u2014 action: labelmap            regex: __meta_kubernetes_pod_label_(.+)          \u2014 source_labels: [__meta_kubernetes_namespace]            action: replace            target_label: kubernetes_namespace          \u2014 source_labels: [__meta_kubernetes_pod_name]            action: replace            target_label: kubernetes_pod_name <\/code><\/pre>\n<p>\u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0443\u0431\u0435\u0434\u0438\u043c\u0441\u044f, \u0447\u0442\u043e \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0435 \u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0438 Redis. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u043e\u0442\u043a\u0440\u044b\u0442\u044c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0438 \u0432\u0432\u0435\u0441\u0442\u0438 PromQL-\u0437\u0430\u043f\u0440\u043e\u0441 <b>redis_up<\/b>:  <\/p>\n<p>  &quot;<img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/ig\/wo\/rt\/igwort0i9cn1ilqmh8wyxqrzmao.png\">  <\/p>\n<p>\u0412 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u043e\u0442 \u0434\u0440\u0443\u0433\u0438\u0445 \u0441\u0438\u0441\u0442\u0435\u043c \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433\u0430, Prometheus \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u043e\u0442 \u0446\u0435\u043b\u0435\u0432\u044b\u0445 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432, \u0430 \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e \u0437\u0430\u0431\u0438\u0440\u0430\u0435\u0442 \u0441 \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0445 \u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438 <b>endpoints<\/b> \u2014 \u044d\u0442\u043e \u043e\u0434\u043d\u0430 \u0438\u0437 \u0435\u0433\u043e \u0432\u0430\u0436\u043d\u0435\u0439\u0448\u0438\u0445 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a. \u041a\u043e\u0433\u0434\u0430 \u0432\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442\u0435 \u0441 \u0431\u043e\u043b\u044c\u0448\u0438\u043c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e\u043c \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432, \u0438 \u043a\u0430\u0436\u0434\u044b\u0439 \u0438\u0437 \u043d\u0438\u0445 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u0432 \u0441\u0438\u0441\u0442\u0435\u043c\u0443 \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433\u0430, \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u0442\u043e\u043b\u043a\u043d\u0443\u0442\u044c\u0441\u044f \u0441 \u0440\u0438\u0441\u043a\u043e\u043c \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u0431\u043e\u043b\u044c\u0448\u043e\u0433\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440 Prometheus, \u0430 \u044d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u0435\u0433\u043e \u0432\u044b\u0445\u043e\u0434\u0443 \u0438\u0437 \u0441\u0442\u0440\u043e\u044f. Prometheus \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0446\u0435\u043d\u0442\u0440\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u043e\u0435 \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0441\u0431\u043e\u0440\u043e\u043c \u043c\u0435\u0442\u0440\u0438\u043a, \u0442.\u0435. \u0432\u044b \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e \u0440\u0435\u0448\u0430\u0435\u0442\u0435, \u043e\u0442\u043a\u0443\u0434\u0430 \u0438 \u043a\u0430\u043a \u0447\u0430\u0441\u0442\u043e \u0437\u0430\u0431\u0438\u0440\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435. \u0415\u0449\u0435 \u043e\u0434\u043d\u043e \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f Prometheus \u2014 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <b>service discovery<\/b>, \u0440\u0430\u0431\u043e\u0442\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0431\u044b\u043b\u0430 \u043f\u0440\u043e\u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u043d\u0430 \u0432\u044b\u0448\u0435 \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 Redis-\u043f\u043e\u0434\u043e\u0432.  <\/p>\n<p>  <\/p>\n<p>\u041d\u043e \u0431\u044b\u0432\u0430\u0435\u0442 \u0441\u043b\u0443\u0447\u0430\u0438, \u043a\u043e\u0433\u0434\u0430 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u043e\u0442 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0430 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e, \u0438 \u0443 Prometheus \u043d\u0435\u0442 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u0437\u0430\u0431\u0438\u0440\u0430\u0442\u044c \u0438\u0445 \u0441 \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0437\u0430\u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0437\u0430\u0434\u0430\u043d\u0438\u044f \u043f\u043e \u043a\u0440\u043e\u043d\u0443, \u0441\u043d\u044f\u0442\u0438\u0435 \u0431\u044d\u043a\u0430\u043f\u043e\u0432 \u0438 \u0442.\u0434.). \u0414\u043b\u044f \u0442\u0430\u043a\u0438\u0445 \u0441\u043b\u0443\u0447\u0430\u0435\u0432 Prometheus \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u0442 <b>pushgateway<\/b>, \u0447\u0442\u043e\u0431\u044b \u0441\u0435\u0440\u0432\u0438\u0441\u044b \u043c\u043e\u0433\u043b\u0438 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0441\u0432\u043e\u0438 \u043c\u0435\u0442\u0440\u0438\u043a\u0438 \u0432 \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445 Prometheus. \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 <b>pushgateway<\/b> \u2014 \u0441\u043a\u043e\u0440\u0435\u0435 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435, \u0447\u0435\u043c \u043f\u0440\u0430\u0432\u0438\u043b\u043e, \u043d\u043e \u043e \u0435\u0433\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043d\u0435 \u0441\u0442\u043e\u0438\u0442 \u0437\u0430\u0431\u044b\u0432\u0430\u0442\u044c.  <\/p>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c, \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043d\u0430\u0448\u0430 \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433\u0430 \u0441\u0442\u0430\u043b\u0430 \u043f\u043e\u043b\u043d\u043e\u0446\u0435\u043d\u043d\u043e\u0439, \u043d\u0443\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043e\u043f\u043e\u0432\u0435\u0449\u0435\u043d\u0438\u044f \u043e \u0432\u044b\u0445\u043e\u0434\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u043c\u0435\u0442\u0440\u0438\u043a \u0437\u0430 \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u044b\u0435 \u043f\u0440\u0435\u0434\u0435\u043b\u044b.  <\/p>\n<p>  <\/p>\n<h3>Alertmanager \u0438 Alerting rules<\/h3>\n<p>  <\/p>\n<p>\u0417\u0430 \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0443 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0439 \u0432 Prometheus \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442 <b>AlertManager<\/b>. \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043a\u0430\u043d\u0430\u043b\u043e\u0432 \u043e\u043f\u043e\u0432\u0435\u0449\u0435\u043d\u0438\u044f \u043c\u043e\u0433\u0443\u0442 \u0432\u044b\u0441\u0442\u0443\u043f\u0430\u0442\u044c: email, slack \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u043a\u043b\u0438\u0435\u043d\u0442\u044b. \u0414\u043b\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 \u043e\u043f\u043e\u0432\u0435\u0449\u0435\u043d\u0438\u044f \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043e\u0431\u043d\u043e\u0432\u0438\u0442\u044c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e \u0444\u0430\u0439\u043b\u0430 alertmanager.yml.  <\/p>\n<p>  <\/p>\n<p>\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0444\u0430\u0439\u043b prometheus\/values.yaml \u0441\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u044b\u043c:  <\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">## alertmanager ConfigMap entries ## alertmanagerFiles:  alertmanager.yml:    global:      slack_api_url: &lt;secret&gt;      route:      receiver: slack-alert      group_by:        \u2014 redis_group      repeat_interval: 30m      routes:        \u2014 match:            severity: critical          receiver: slack-alert      receivers:      \u2014 name: slack-alert        slack_configs:          \u2014 channel: 'general'            send_resolved: true            color: '{{ if eq .Status &quot;firing&quot; }}danger{{ else }}good{{ end }}'            title: '[{{ .Status | toUpper }}{{ if eq .Status &quot;firing&quot; }}:{{ .Alerts.Firing              | len }}{{ end }}] {{ .CommonAnnotations.summary }}'            text: |-              {{ range .Alerts }}                *Alert:* {{ .Annotations.summary }} \u2014 *{{ .Labels.severity | toUpper }}* on {{ .Labels.instance }}                *Description:* {{ .Annotations.description }}                *Details:*                {{ range .Labels.SortedPairs }} \u2022 *{{ .Name }}:* `{{ .Value }}`                {{ end }}              {{ end }}  <\/code><\/pre>\n<p>  <\/p>\n<p><b>Slack_api_url<\/b> \u0434\u043e\u043b\u0436\u0435\u043d \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u043a\u043b\u044e\u0447, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043d\u0430 \u0441\u0430\u0439\u0442\u0435 <a href=\"https:\/\/slack.com\/\">Slack<\/a>.  <\/p>\n<p>  <\/p>\n<p>\u0412 \u043f\u043e\u043b\u0435 <b>channel <\/b>\u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043a\u0430\u043d\u0430\u043b, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0443\u0442 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u044c \u043e\u043f\u043e\u0432\u0435\u0449\u0435\u043d\u0438\u044f. \u0412 \u043d\u0430\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u044d\u0442\u043e general. \u041e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u043e\u0442\u0432\u0435\u0447\u0430\u044e\u0442 \u0437\u0430 \u0444\u043e\u0440\u043c\u0430\u0442 \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u0439.  <\/p>\n<p>  <\/p>\n<p>\u041a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e, \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u0443\u044e \u0434\u0430\u043b\u0435\u0435, \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0432 <a href=\"https:\/\/gitlab.com\/radikkit\/monitoring\">\u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438<\/a>.  <\/p>\n<p>  <\/p>\n<p>\u041e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u043c my-prometheus:  <\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">helm upgrade my-prometheus -f prometheus\/values.yaml stable\/prometheus -n monitoring <\/code><\/pre>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u043a \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0443 Alertmanager, \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:  <\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">export POD_NAME=$(kubectl get pods --namespace monitoring -l &quot;app=prometheus,component=alertmanager&quot; -o jsonpath=&quot;{.items[0].metadata.name}&quot;) kubectl --namespace monitoring port-forward $POD_NAME 9093 <\/code><\/pre>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0432 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0435 <b>Alertmanager<\/b> \u043c\u043e\u0436\u043d\u043e \u0443\u0431\u0435\u0434\u0438\u0442\u044c\u0441\u044f, \u0447\u0442\u043e \u043f\u043e\u044f\u0432\u0438\u043b\u0430\u0441\u044c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f \u0434\u043b\u044f \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0438 \u043e\u043f\u043e\u0432\u0435\u0449\u0435\u043d\u0438\u044f \u0432 \u043a\u0430\u043d\u0430\u043b Slack <a href=\"http:\/\/127.0.0.1:9093\/#\/status\">http:\/\/127.0.0.1:9093\/#\/status<\/a>:  <\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/5b\/zf\/f_\/5bzff_iz8iqisgkkuij7m8fymoa.png\">  <\/p>\n<p>\u0414\u0430\u043b\u0435\u0435 \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043f\u0440\u0430\u0432\u0438\u043b\u0430, \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u043d\u043e\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f \u0431\u0443\u0434\u0435\u0442 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c\u0441\u044f \u0432 Slack-\u043a\u0430\u043d\u0430\u043b.  <\/p>\n<p>  <\/p>\n<p>\u041f\u0440\u0430\u0432\u0438\u043b\u0430 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 \u0441\u043e\u0431\u043e\u0439 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043c\u0435\u0442\u0440\u0438\u043a \u0438\u043b\u0438 \u0438\u0445 \u0441\u043e\u0432\u043e\u043a\u0443\u043f\u043d\u043e\u0441\u0442\u0438, \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u043d\u044b\u0435 \u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0438\u043c \u0443\u0441\u043b\u043e\u0432\u0438\u0435\u043c. \u041f\u0440\u0438 \u0432\u044b\u0445\u043e\u0434\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043c\u0435\u0442\u0440\u0438\u043a\u0438 \u0437\u0430 \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u044b\u0435 \u043f\u0440\u0435\u0434\u0435\u043b\u044b Prometheus \u043e\u0431\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u043a Alertmanager, \u0447\u0442\u043e\u0431\u044b \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u043d\u043e\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u043f\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u043c \u0432 \u043d\u0435\u043c \u043a\u0430\u043d\u0430\u043b\u0430\u043c. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0435\u0441\u043b\u0438 \u043c\u0435\u0442\u0440\u0438\u043a\u0430 redis_up \u0432\u0435\u0440\u043d\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 0, \u0441\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u0435 \u043e \u043d\u0435\u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e\u0441\u0442\u0438 \u0442\u043e\u0433\u043e \u0438\u043b\u0438 \u0438\u043d\u043e\u0433\u043e \u0443\u0437\u043b\u0430 \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430.  <\/p>\n<p>  <\/p>\n<p>\u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0432 \u0444\u0430\u0439\u043b prometheus\/values.yaml \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u0434\u043b\u044f \u0441\u0438\u0433\u043d\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043e \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430\u0445 \u0432 Redis:  <\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">serverFiles:    ## Alerts configuration  ## Ref: https:\/\/prometheus.io\/docs\/prometheus\/latest\/configuration\/alerting_rules\/  alerting_rules.yml:    groups:      \u2014 name: redis_group        rules:          \u2014 alert: redis_is_running            expr: redis_up == 0            for: 30s            labels:              severity: critical            annotations:              summary: &quot;Critical: Redis is down on the host {{ $labels.instance }}.&quot;              description: &quot;Redis has been down for more than 30 seconds&quot;          \u2014 alert: redis_memory_usage            expr:  redis_memory_used_bytes \/ redis_memory_max_bytes * 100 &gt; 40            for: 5m            labels:              severity: warning            annotations:              description: &quot;Warning: Redis high memory(&gt;40%) usage on the host {{ $labels.instance }} for more than 5 minutes&quot;              summary: &quot;Redis memory usage {{ humanize $value}}% of the host memory&quot;          \u2014 alert: redis_master            expr: redis_connected_clients{instance!~&quot;server1.mydomain.com.+&quot;} &gt; 50            for: 5m            labels:              severity: warning            annotations:              description: &quot;Warning: Redis has many connections on the host {{ $labels.instance }} for more than 5 minutes&quot;              summary: &quot;Redis number of connections {{ $value }}&quot;          \u2014 alert: redis_rejected_connections            expr: increase(redis_rejected_connections_total[1m]) &gt; 0            for: 30s            labels:              severity: critical            annotations:              description: &quot;Critical: Redis rejected connections on the host {{ $labels.instance }}&quot;              summary: &quot;Redis rejected connections are {{ $value }}&quot;          \u2014 alert: redis_evicted_keys            expr: increase(redis_evicted_keys_total[1m]) &gt; 0            for: 30s            labels:              severity: critical            annotations:              description: &quot;Critical: Redis evicted keys on the host {{ $labels.instance }}&quot;              summary: &quot;Redis evicted keys are {{ $value }}&quot; <\/code><\/pre>\n<p>  <\/p>\n<p>\u041e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u043c my-prometheus:  <\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">helm upgrade my-prometheus -f prometheus\/values.yaml stable\/prometheus -n monitoring <\/code><\/pre>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0440\u0430\u0431\u043e\u0442\u044b \u043d\u043e\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u0432 Slack, \u0438\u0437\u043c\u0435\u043d\u0438\u043c \u043f\u0440\u0430\u0432\u0438\u043b\u043e \u0430\u043b\u0435\u0440\u0442\u0430 <b>redis_memory_usage<\/b>:  <\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\"> expr:  redis_memory_used_bytes \/ redis_memory_max_bytes * 100 &lt; 40 <\/code><\/pre>\n<p>  <\/p>\n<p>\u0421\u043d\u043e\u0432\u0430 \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u043c my-prometheus:  <\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">helm upgrade my-prometheus -f prometheus\/values.yaml stable\/prometheus -n monitoring <\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043d\u0430 \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 <a href=\"http:\/\/127.0.0.1:9090\/alerts\">http:\/\/127.0.0.1:9090\/alerts<\/a>:  <\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/y2\/ut\/mz\/y2utmztk_whmiflaof6zrlboywi.png\">  <\/p>\n<p>Redis_memory_usage \u043f\u0435\u0440\u0435\u0448\u0435\u043b \u0432 \u0441\u0442\u0430\u0442\u0443\u0441 \u00abpending\u00bb. \u0417\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u0442\u0440\u0435\u0445 \u043f\u043e\u0434\u043e\u0432 \u0447\u0443\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435 0.72. \u0414\u0430\u043b\u0435\u0435 \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u0442 \u0432 Slack:  <\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/xt\/qr\/1b\/xtqr1b3xaeznmfxtawfcwtnguzm.png\">  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043d\u043e\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044e \u043f\u043e email. \u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f alermanager.yml \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u0441\u044f \u0442\u0430\u043a:  <\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">alertmanagerFiles:  alertmanager.yml:    global:      slack_api_url: &lt;secret&gt;      route:      receiver: slack-alert      group_by:        \u2014 redis_group      repeat_interval: 30m      routes:        \u2014 match:            severity: critical          receiver: slack-alert          continue: true        \u2014 match:            severity: critical          receiver: email-alert      receivers:      \u2014 name: slack-alert        slack_configs:          \u2014 channel: 'general'            send_resolved: true            color: '{{ if eq .Status &quot;firing&quot; }}danger{{ else }}good{{ end }}'            title: '[{{ .Status | toUpper }}{{ if eq .Status &quot;firing&quot; }}:{{ .Alerts.Firing              | len }}{{ end }}] {{ .CommonAnnotations.summary }}'            text: |-              {{ range .Alerts }}                *Alert:* {{ .Annotations.summary }} \u2014 *{{ .Labels.severity | toUpper }}* on {{ .Labels.instance }}                *Description:* {{ .Annotations.description }}                *Details:*                {{ range .Labels.SortedPairs }} \u2022 *{{ .Name }}:* `{{ .Value }}`                {{ end }}              {{ end }}      \u2014 name: email-alert        email_configs:        \u2014 to: alert@agima.ru          send_resolved: true          require_tls: false          from: alert@agima.ru          smarthost: smtp.agima.ru:465          auth_username: &quot;alert@agima.ru&quot;          auth_identity: &quot;alert@agima.ru&quot;          auth_password: &lt;secret&gt;  <\/code><\/pre>\n<p>  <\/p>\n<p>\u0412 \u0431\u043b\u043e\u043a routes \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0435\u0449\u0435 \u043e\u0434\u0438\u043d \u043f\u0443\u0442\u044c \u0434\u043b\u044f \u043d\u043e\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438:<b> receiver: email-alert.<\/b> \u041d\u0438\u0436\u0435 \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u0434\u043b\u044f email. \u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u0440\u0438 \u0442\u043e\u043c \u0438\u043b\u0438 \u0438\u043d\u043e\u043c \u0441\u043e\u0431\u044b\u0442\u0438\u0438 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u0443\u0432\u0435\u0434\u043e\u043c\u043b\u0435\u043d\u0438\u044f \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u0432 Slack \u0438 \u043d\u0430 email:  <\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/mv\/pi\/by\/mvpibyqf2psz99mjm26apl9fyzq.png\"><\/p>\n<h3>Blackbox exporter<\/h3>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u043a\u0430\u043a \u0432 Prometheus \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u044e\u0442\u0441\u044f <b>targets<\/b> \u043d\u0430 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043a\u043e\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0430 <b>blackbox exporter<\/b>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433 \u0432\u043d\u0435\u0448\u043d\u0438\u0445 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u043f\u043e \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0430\u043c HTTP(s), DNS, TCP, ICMP.   <\/p>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 blackbox exporter \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c Helm:  <\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">helm install blackbox-exporter stable\/prometheus-blackbox-exporter --namespace monitoring  <\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u0447\u0442\u043e \u043f\u043e\u0434\u044b blackbox exporter \u0437\u0430\u043f\u0443\u0449\u0435\u043d\u044b:  <\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">kubectl get pods -n monitoring | grep blackbox blackbox-exporter-prometheus-blackbox-exporter-df9f6d679-tvhrp   1\/1     Running   0          20s <\/code><\/pre>\n<p>  <\/p>\n<p>\u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0432 \u0444\u0430\u0439\u043b prometheus\/values.yaml \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0443\u044e \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e:  <\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">extraScrapeConfigs: |  \u2014 job_name: 'prometheus-blackbox-exporter'    metrics_path: \/probe    params:      module: [http_2xx]    static_configs:      \u2014 targets:        \u2014 https:\/\/example.org      relabel_configs:      \u2014 source_labels: [__address__]        target_label: __param_target      \u2014 source_labels: [__param_target]        target_label: instance      \u2014 target_label: __address__        replacement: blackbox-exporter-prometheus-blackbox-exporter.monitoring.svc.cluster.local:9115  <\/code><\/pre>\n<p>  <\/p>\n<p>\u0423\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c, \u043e\u0442\u043a\u0443\u0434\u0430 \u0441\u043e\u0431\u0438\u0440\u0430\u0442\u044c \u043c\u0435\u0442\u0440\u0438\u043a\u0438:  <\/p>\n<p>  <\/p>\n<p>blackbox-exporter-prometheus-blackbox-exporter.monitoring.svc.cluster.local:9115\/probe. \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 targets \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c URL \u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u0434\u043b\u044f \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433\u0430: <a href=\"https:\/\/example.org\">https:\/\/example.org<\/a>. \u0414\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043c\u043e\u0434\u0443\u043b\u044c http_2xx, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0432 <b>blackbox exporter<\/b>. \u041a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438:  <\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">secretConfig: false config:  modules:    http_2xx:      prober: http      timeout: 5s      http:        valid_http_versions: [&quot;HTTP\/1.1&quot;, &quot;HTTP\/2&quot;]        no_follow_redirects: false        preferred_ip_protocol: &quot;ip4&quot; <\/code><\/pre>\n<p>  <\/p>\n<p>\u041e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u043c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e my-prometheus:  <\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">helm upgrade my-prometheus -f prometheus\/values.yaml stable\/prometheus -n monitoring <\/code><\/pre>\n<p>  <\/p>\n<p>\u0412 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0435 Prometheus <a href=\"http:\/\/127.0.0.1:9090\/targets\">http:\/\/127.0.0.1:9090\/targets <\/a>\u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u0447\u0442\u043e \u0443 \u043d\u0430\u0441 \u043f\u043e\u044f\u0432\u0438\u043b\u0430\u0441\u044c \u043a\u043e\u043d\u0435\u0447\u043d\u0430\u044f \u0442\u043e\u0447\u043a\u0430 \u0434\u043b\u044f \u0441\u0431\u043e\u0440\u0430 \u043c\u0435\u0442\u0440\u0438\u043a:  <\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/9y\/sg\/2d\/9ysg2doc6xaixjafyjfsoutymgg.png\">  <\/p>\n<p>\u0427\u0442\u043e\u0431\u044b \u0440\u0430\u0441\u0448\u0438\u0440\u0438\u0442\u044c \u043e\u0431\u043b\u0430\u0441\u0442\u044c \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438, \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c http_2xx_check-\u043c\u043e\u0434\u0443\u043b\u044c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439, \u043f\u043e\u043c\u0438\u043c\u043e \u0432\u0430\u043b\u0438\u0434\u0430\u0446\u0438\u0438 \u0432\u0435\u0440\u0441\u0438\u0438 \u0438 \u0441\u0442\u0430\u0442\u0443\u0441\u0430 200 http, \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u0437\u0430\u0434\u0430\u043d\u043d\u043e\u0433\u043e \u0442\u0435\u043a\u0441\u0442\u0430 \u0432 \u0442\u0435\u043b\u0435 \u043e\u0442\u0432\u0435\u0442\u0430:  <\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">secretConfig: false config:  modules:    http_2xx:      prober: http      timeout: 5s      http:        valid_http_versions: [&quot;HTTP\/1.1&quot;, &quot;HTTP\/2&quot;]        no_follow_redirects: false        preferred_ip_protocol: &quot;ip4&quot;        valid_status_codes: [200]    http_2xx_check:      prober: http      timeout: 5s      http:        method: GET        fail_if_body_not_matches_regexp:        \u2014 &quot;Example Domain&quot;        fail_if_not_ssl: true        preferred_ip_protocol: ip4        valid_http_versions: [&quot;HTTP\/1.1&quot;, &quot;HTTP\/2&quot;]        valid_status_codes: [200] <\/code><\/pre>\n<p>  <\/p>\n<p>\u041e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u043c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e blackbox-exporter\/values.yaml:<\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">helm upgrade blackbox-exporter -f blackbox-exporter\/values.yaml stable\/prometheus-blackbox-exporter --namespace monitoring <\/code><\/pre>\n<p>  <\/p>\n<p>\u0418\u0437\u043c\u0435\u043d\u044f\u0435\u043c \u0432 \u0444\u0430\u0439\u043b\u0435 prometheus\/values.yaml \u043c\u043e\u0434\u0443\u043b\u044c<b> http_2xx <\/b>\u043d\u0430 <b>http_2xx_check<\/b>:  <\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">extraScrapeConfigs: |  \u2014 job_name: 'prometheus-blackbox-exporter'    metrics_path: \/probe    params:      module: [http_2xx] <\/code><\/pre>\n<p>  <\/p>\n<p>\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043e\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0436\u043d\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u0441 blackbox exporter, \u043f\u0440\u0438\u0432\u0435\u0434\u0435\u043d\u044b \u0432 <a href=\"https:\/\/github.com\/prometheus\/blackbox_exporter\/blob\/master\/CONFIGURATION.md\">\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438<\/a>.  <\/p>\n<p>  <\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u043f\u0440\u0430\u0432\u0438\u043b\u0430 \u0434\u043b\u044f \u0441\u0438\u0433\u043d\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0432 Prometheus \u0432 \u0444\u0430\u0439\u043b prometheus\/values.yaml:  <\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">  \u2014 name: http_probe        rules:          \u2014 alert: example.org_down            expr: probe_success{instance=&quot;https:\/\/example.org&quot;,job=&quot;prometheus-blackbox-exporter&quot;} == 0            for: 5s            labels:              severity: critical            annotations:              description: '{{ $labels.instance }} of job {{ $labels.job }} has been down for more than 1 minutes.'              summary: 'Instance {{ $labels.instance }} down'  <\/code><\/pre>\n<p>  <\/p>\n<p>\u0418 \u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u043c \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u044e my-prometheus:  <\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">helm upgrade my-prometheus -f prometheus\/values.yaml stable\/prometheus -n monitoring <\/code><\/pre>\n<p>  <\/p>\n<p>\u0414\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043c\u043e\u0436\u043d\u043e \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0432 blackbox-exporter\/values.yaml \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0442\u0435\u043a\u0441\u0442\u0430 \u0434\u043b\u044f \u043c\u043e\u0434\u0443\u043b\u044f <b>http_2xx_check<\/b>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u0449\u0435\u0442\u0441\u044f \u0432 \u0442\u0435\u043b\u0435 \u043e\u0442\u0432\u0435\u0442\u0430, \u0438 \u043e\u0431\u043d\u043e\u0432\u0438\u0442\u044c blackbox exporter. \u0414\u043e\u043b\u0436\u043d\u0430 \u0441\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043d\u043e\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f \u0432 Slack \u0438 Email.   <\/p>\n<h3>Grafana<\/h3>\n<p>  <\/p>\n<p>\u041d\u0430\u0441\u0442\u0430\u043b\u0430 \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438. \u0414\u043b\u044f \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0433\u0440\u0430\u0444\u0438\u043a\u043e\u0432 \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <br \/>  <b>Grafana<\/b>.  <\/p>\n<p>  <\/p>\n<p>\u0423\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u0435\u0433\u043e \u0443\u0436\u0435 \u043f\u0440\u0438\u0432\u044b\u0447\u043d\u044b\u043c \u0434\u043b\u044f \u043d\u0430\u0441 \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043f\u0430\u043a\u0435\u0442\u043d\u043e\u0433\u043e \u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440\u0430 Helm:  <\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">helm install my-grafana bitnami\/grafana -n monitoring --set=persistence.enabled=false <\/code><\/pre>\n<p>  <\/p>\n<p>\u0412 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u0445 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u00ab\u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c persistent volume\u00bb (&#8212;set=persistence.enabled=false), \u0447\u0442\u043e\u0431\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0440\u043e\u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0443 grafana. \u0412 \u043f\u0440\u043e\u0434\u0430\u043a\u0448\u043d- \u0441\u0440\u0435\u0434\u0435 \u043d\u0443\u0436\u043d\u043e \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435, \u0442\u0430\u043a \u043a\u0430\u043a \u043f\u043e\u0434\u044b \u043f\u043e \u0441\u0432\u043e\u0435\u0439 \u043f\u0440\u0438\u0440\u043e\u0434\u0435 \u044d\u0444\u0435\u043c\u0435\u0440\u043d\u044b, \u0438 \u0435\u0441\u0442\u044c \u0440\u0438\u0441\u043a \u043f\u043e\u0442\u0435\u0440\u044f\u0442\u044c \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438 Grafana.  <\/p>\n<p>  <\/p>\n<p>\u0414\u043e\u043b\u0436\u0435\u043d \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c\u0441\u044f \u0432\u043e\u0442 \u0442\u0430\u043a\u043e\u0439 \u0432\u044b\u0432\u043e\u0434:  <\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">2. Get the admin credentials:      echo &quot;User: admin&quot;     echo &quot;Password: $(kubectl get secret my-grafana-admin --namespace monitoring -o jsonpath=&quot;{.data.GF_SECURITY_ADMIN_PASSWORD}&quot; | base64 --decode)&quot; <\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u0447\u0442\u043e \u043f\u043e\u0434 Grafana \u0437\u0430\u043f\u0443\u0449\u0435\u043d:  <\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">$kubectl get pods -n monitoring | grep grafana NAME                                               READY   STATUS    RESTARTS   AGE my-grafana-67c9776d7-nwbqj                         1\/1     Running   0          55s  <\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u0435\u0440\u0435\u0434 \u0442\u0435\u043c \u043a\u0430\u043a \u043e\u0442\u043a\u0440\u044b\u0442\u044c \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 Grafana, \u043d\u0443\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043f\u0430\u0440\u043e\u043b\u044c \u043e\u0442 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f admin, \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0442\u0430\u043a:  <\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">$echo &quot;Password: $(kubectl get secret my-grafana-admin --namespace monitoring -o jsonpath=&quot;{.data.GF_SECURITY_ADMIN_PASSWORD}&quot; | base64 --decode)&quot; <\/code><\/pre>\n<p>  <\/p>\n<p>\u0417\u0430\u0442\u0435\u043c \u00ab\u043f\u0440\u043e\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0435\u043c\u00bb \u043f\u043e\u0440\u0442 Grafana:  <\/p>\n<p>  <\/p>\n<pre><code class=\"plaintext\">kubectl port-forward -n monitoring svc\/my-grafana 8080:3000 <\/code><\/pre>\n<p>  <\/p>\n<p>\u041e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u043c <a href=\"http:\/\/127.0.0.1:9090\/\">http:\/\/127.0.0.1:9090\/<\/a> \u0432 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0435 \u0438 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0443\u0435\u043c\u0441\u044f:  <\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/ed\/se\/uu\/edseuu1fsjmxclvekxj1znh6x_c.png\">  <\/p>\n<p>\u0414\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431\u044b Grafana \u043c\u043e\u0433\u043b\u0430 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043c\u0435\u0442\u0440\u0438\u043a, \u0445\u0440\u0430\u043d\u044f\u0449\u0438\u0445\u0441\u044f \u0432 \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 Prometheus, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043f\u043e\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u0435\u0433\u043e. \u041f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043d\u0430 <a href=\"http:\/\/127.0.0.1:8080\/datasources\">http:\/\/127.0.0.1:8080\/datasources <\/a>\u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c <b>data source.<\/b> \u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 TSDB \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u043c Prometheus, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0432 \u043d\u0430\u0448\u0435\u043c \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0435 \u043f\u043e \u0430\u0434\u0440\u0435\u0441\u0443 my-prometheus-server.monitoring.svc.cluster.local.  <\/p>\n<p>  <\/p>\n<p>\u0414\u043e\u043b\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c\u0441\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a:  <\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/7k\/gd\/lg\/7kgdlgfp1bxohptl5tmmv3nvmhu.png\">  <\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u044f <b>data source<\/b> \u043d\u0443\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c dashboard \u0432 Grafana \u2014 \u0447\u0442\u043e\u0431\u044b \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0435\u0439 Redis-\u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u043b\u0438\u0441\u044c \u043d\u0430 \u0433\u0440\u0430\u0444\u0438\u043a\u0430\u0445. \u041f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043d\u0430 <a href=\"http:\/\/127.0.0.1:8080\/dashboard\/import\">http:\/\/127.0.0.1:8080\/dashboard\/import<\/a> \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c id = <a href=\"https:\/\/grafana.com\/grafana\/dashboards\/763\">763<\/a>. \u0418\u0442\u043e\u0433:  <\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/vm\/lh\/_j\/vmlh_jrqvhlxxdnrf-0lhd4lr6s.png\">  <\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u0438\u043c\u043f\u043e\u0440\u0442\u0430 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 dashboard \u0441 \u0432\u0438\u0434\u0436\u0435\u0442\u0430\u043c\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0430\u044e\u0442 \u0441\u043e\u0431\u0440\u0430\u043d\u043d\u044b\u0435 \u043c\u0435\u0442\u0440\u0438\u043a\u0438 c \u043a\u043b\u0430\u0441\u0442\u0435\u0440\u0430 Redis:  <\/p>\n<p>  <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/to\/4x\/ny\/to4xnys1pk_j-ftkozuo8w3ukt8.png\">  <\/p>\n<p>\u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u043e\u0431\u0438\u0440\u0430\u0442\u044c \u0442\u0430\u043a\u0438\u0435 \u0434\u0430\u0448\u0431\u043e\u0440\u0434\u044b \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e \u0438\u043b\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0443\u0436\u0435 <a href=\"https:\/\/grafana.com\/grafana\/dashboards\">\u0433\u043e\u0442\u043e\u0432\u044b\u0435<\/a>.  <\/p>\n<p>  <\/p>\n<p>\u0412\u043e\u0442, \u0432 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0435, \u0438 \u0432\u0441\u0451. \u041d\u0430\u0434\u0435\u044e\u0441\u044c, \u0447\u0442\u043e \u0441\u0443\u043c\u0435\u043b \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u0432\u0430\u043c \u0447\u0442\u043e-\u0442\u043e \u043d\u043e\u0432\u043e\u0435. \u0410 \u0433\u043b\u0430\u0432\u043d\u043e\u0435 \u2014 \u0443\u0431\u0435\u0434\u0438\u043b, \u0447\u0442\u043e \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f Prometheus \u043f\u0440\u043e\u0441\u0442\u043e \u0438 \u0443\u0434\u043e\u0431\u043d\u043e!  <\/p>\n<\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/company\/agima\/blog\/524654\/\"> https:\/\/habr.com\/ru\/company\/agima\/blog\/524654\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text-html post__text_v1\" id=\"post-content-body\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/webt\/ke\/vw\/wi\/kevwwicwhh_ginf9fqaidqpvccq.jpeg\"><\/p>\n<p>\u0412 \u044d\u0442\u043e\u0438\u0306 \u0441\u0442\u0430\u0442\u044c\u0435 \u044f \u043f\u043e\u0441\u0442\u0430\u0440\u0430\u043b\u0441\u044f \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c, \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c Prometheus \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u044b \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433\u0430 \u0434\u043b\u044f \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u043d\u043e\u0438\u0306 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u044b. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043b \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0443 Prometheus \u0438 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0438\u0306\u0441\u0442\u0432\u0438\u0435 \u0435\u0433\u043e \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0432. \u041e\u0431\u043e\u0437\u043d\u0430\u0447\u0438\u043b \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0435 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0441\u0442\u0438\u043a\u0438 \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u0447\u0435\u043c\u0443 \u044d\u0442\u0430 \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0430 \u0442\u0430\u043a\u043e\u0435 \u0448\u0438\u0440\u043e\u043a\u043e\u0435 \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u0438\u0435 \u0432 \u0441\u0440\u0435\u0434\u0430\u0445 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0438\u0445 \u043a\u043e\u043d\u0442\u0435\u0438\u0306\u043d\u0435\u0440\u0438\u0437\u0430\u0446\u0438\u044e. \u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0430\u044e \u0441\u0440\u0430\u0437\u0443: \u0441\u0442\u0430\u0442\u044c\u044f \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0430\u0441\u044c \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043e\u0431\u044a\u0435\u043c\u043d\u043e\u0439. \u042d\u0442\u0430 \u0441\u0442\u0430\u0442\u044c\u0441\u044f \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043b\u0435\u0437\u043d\u0430 \u0434\u043b\u044f \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0449\u0438\u0445 DevOps \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u0438\u0441\u0442\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043b\u0430\u043d\u0438\u0440\u0443\u044e\u0442 \u0438\u043b\u0438 \u0443\u0436\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442 \u0432 \u0441\u0432\u043e\u0435\u0438\u0306 \u0440\u0430\u0431\u043e\u0442\u0435 Docker, Kubernetes. \u0418\u0442\u0430\u043a, \u043d\u0430\u0447\u043d\u0435\u043c!  <\/p>\n<p>  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-312250","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/312250","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=312250"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/312250\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=312250"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=312250"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=312250"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}