{"id":396450,"date":"2024-06-29T12:50:52","date_gmt":"2024-06-29T12:50:52","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=396450"},"modified":"-0001-11-30T00:00:00","modified_gmt":"2024-06-29T12:50:52","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=396450","title":{"rendered":"<span>\u0410\u043b\u0435\u0440\u0442\u044b \u0432 \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u043d\u043e\u0439 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0435<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0412 \u044d\u0442\u043e\u043c \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0435 \u044f \u043f\u043e\u0441\u0442\u0430\u0440\u0430\u044e\u0441\u044c \u043e\u043f\u0438\u0441\u0430\u0442\u044c \u043e\u0434\u0438\u043d \u0438\u0437 \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u0432 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u0438 \u0430\u043b\u0435\u0440\u0442\u043e\u0432 \u0432 \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u043d\u043e\u0439 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0435.<\/p>\n<p>\u0412\u00a0\u043d\u0435\u0437\u0430\u043f\u0430\u043c\u044f\u0442\u043d\u044b\u0435 \u0432\u0440\u0435\u043c\u0435\u043d\u0430, \u043a\u043e\u0433\u0434\u0430 \u0435\u0449\u0435 \u043d\u0435\u00a0\u0432\u044b\u0448\u043b\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044f\u044f \u0441\u0435\u0440\u0438\u044f \u00ab\u0412\u043e \u0432\u0441\u0435 \u0442\u044f\u0436\u043a\u0438\u0435\u00bb, \u0430\u043b\u0435\u0440\u0442\u044b \u0447\u0430\u0449\u0435 \u0432\u0441\u0435\u0433\u043e \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0441\u044c \u0432\u00a0\u043e\u0434\u043d\u043e\u043c \u043c\u0435\u0441\u0442\u0435\u00a0\u2014 \u0431\u0443\u0434\u044c \u0442\u043e icinga, zabbix, TICK stack \u0438\u043b\u0438\u00a0\u0442\u043e\u0442\u00a0\u0436\u0435 \u0441\u0430\u043c\u044b\u0439 Prometheus. \u0412\u00a0\u044d\u0442\u043e\u043c \u0435\u0441\u0442\u044c \u0441\u0432\u043e\u0438 \u043f\u043b\u044e\u0441\u044b\u00a0\u2014 \u043c\u043e\u0436\u043d\u043e \u043b\u0435\u0433\u043a\u043e \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u0442\u044c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f, \u0433\u0440\u0435\u043f\u043d\u0443\u0442\u044c \u043d\u0443\u0436\u043d\u044b\u0439 \u0430\u043b\u0435\u0440\u0442, \u043d\u0430\u043a\u0438\u0434\u0430\u0442\u044c CI \u0438 \u0442\u0430\u043a \u0434\u0430\u043b\u0435\u0435. \u041d\u043e\u00a0\u043a\u043e\u0433\u0434\u0430 \u0440\u0435\u0447\u044c \u0437\u0430\u0445\u043e\u0434\u0438\u0442 \u043e\u00a0\u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u043d\u043e\u0439 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430, \u0433\u0434\u0435 \u0431\u0438\u0437\u043d\u0435\u0441 \u043b\u043e\u0433\u0438\u043a\u0430 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0430 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u043c\u0438 \u0441\u0435\u0440\u0432\u0438\u0441\u0430\u043c\u0438,\u00a0\u0431\u044b\u043b\u043e\u00a0\u0431\u044b \u043b\u043e\u0433\u0438\u0447\u043d\u044b\u043c \u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0431\u0438\u0437\u043d\u0435\u0441 \u0430\u043b\u0435\u0440\u0442\u0438\u043d\u0433 \u0432\u00a0\u043a\u043e\u0434\u0435 \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u0430. <\/p>\n<p>\u0427\u0442\u043e\u00a0\u0436, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0442\u0430\u043a\u043e\u0439 \u043f\u043e\u0434\u0445\u043e\u0434.<\/p>\n<p>\u0412\u00a0\u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433\u0430 Prometheus\/Alertmanager, \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442\u0430\u044f \u0432\u00a0k8s. \u041c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441 \u0442\u043e\u0436\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0432\u00a0k8s. \u041d\u043e\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u0431\u0443\u0434\u0435\u043c \u0441\u043b\u0430\u0442\u044c \u0432\u00a0Slack.<\/p>\n<p>\u0418\u0442\u0430\u043a \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u043c.<\/p>\n<p>\u0427\u0442\u043e\u0431\u044b \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0442\u0435\u043b\u043e \u0430\u043b\u0435\u0440\u0442\u0430 \u0440\u044f\u0434\u043e\u043c \u0441\u00a0\u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u043e\u043c, \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f <a href=\"https:\/\/github.com\/prometheus-operator\/kube-prometheus\/blob\/main\/manifests\/prometheus-prometheusRule.yaml\">PrometheusRule<\/a>. <\/p>\n<p>\u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0432\u00a0values \u043d\u0430\u0448\u0435\u0433\u043e \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u043d\u0443\u0436\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0438 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043f\u0440\u0430\u0432\u0438\u043b\u043e \u0432\u00a0\u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438 \u0441\u00a0\u0445\u0435\u043b\u044c\u043c \u0447\u0430\u0440\u0442\u043e\u043c:<\/p>\n<pre><code>{{- if .Values.prometheusRule.enabled }} --- apiVersion: monitoring.coreos.com\/v1 kind: PrometheusRule metadata:   labels:     {{- include \"ms-awesome.labels\" . | indent 4 }}     release: {{ .Values.prometheusRule.release |default(\"kube-prometheus-stack\") }}   name: ms-awesome-rule spec:   groups:     - name: ms-awesome-alerts       rules:        - alert: ms-awesome-alert          expr: test_metric{kubernetes_pod_name=~\"ms-awesome.*\"} == 1          for: 20s          labels:            severity: critical            product: \"{{ .Values.alert_info.product }}\"          annotations:            description: 'Test header in ms-awesome alert'            summary: 'This is test alert from ms-awesome' {{- end }}<\/code><\/pre>\n<p>\u0414\u0430\u043b\u0435\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u043c Prometheus \u0438 Alertmanager. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u0447\u0430\u0440\u0442\u043e\u043c kube-prometheus-stack. \u041d\u0430\u0441\u0442\u0440\u043e\u0438\u043c \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0443 \u0430\u043b\u0435\u0440\u0442\u043e\u0432 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 label product:<\/p>\n<pre><code>ms-awesome-k8s-chart.yml --- ## Alertmanager configuration directives ## ref: https:\/\/prometheus.io\/docs\/alerting\/configuration\/#configuration-file ##      https:\/\/prometheus.io\/webtools\/alerting\/routing-tree-editor\/  alertmanager:   enabled: true   ## Api that prometheus will use to communicate with alertmanager. Possible values are v1, v2   ##   apiVersion: v2    alertmanagerSpec:     externalUrl: http:\/\/prometheus-url-for-our-ms\/prometheus\/alerts?search=    ## Service account for Alertmanager to use.   ## ref: https:\/\/kubernetes.io\/docs\/tasks\/configure-pod-container\/configure-service-account\/   ##   serviceAccount:     create: true     name: \"\"     annotations: {}    ## Configure pod disruption budgets for Alertmanager   ## ref: https:\/\/kubernetes.io\/docs\/tasks\/run-application\/configure-pdb\/#specifying-a-poddisruptionbudget   ## This configuration is immutable once created and will require the PDB to be deleted to be changed   ## https:\/\/github.com\/kubernetes\/kubernetes\/issues\/45398   ##   podDisruptionBudget:     enabled: false     minAvailable: 1     maxUnavailable: \"\"    config:     global:       resolve_timeout: 5m       slack_api_url: 'https:\/\/hooks.slack.com\/services\/awesome-link-for-alerts-channel'     templates:       - '\/etc\/alertmanager\/config\/*.tmpl'     route:       group_by: ['alertname', 'cluster', 'namespace']       group_wait: 30s       group_interval: 1m       repeat_interval: 1m       receiver: 'blackhole'       routes:         - receiver: \"default-receiver\"           matchers:             - severity =~ \"critical\"           continue: true         - receiver: \"ms-awesome-receiver\"           matchers:             - product = \"ms-awesome\"             - severity =~ \"warning|critical\"           continue: true      receivers:       - name: 'blackhole'       - name: 'default-receiver'       - name: 'ms-awesome-receiver'         slack_configs:           - channel: '{{ index ((index .Alerts 0).Labels) \"slack_channel_monitoring\" }}'             color: \"{{ if eq .Status `firing` }}#000080{{ else }}good{{ end }}\"             title: '{{ if eq .Status `firing` }}:scream:{{ else }}:heavy_check_mark:{{ end }} [{{ .Status | toUpper }}] {{ .Annotations.description }}'             text: '{{ .Annotations.summary }}'   tplConfig: false    ## Alertmanager template files to format alerts   ## By default, templateFiles are placed in \/etc\/alertmanager\/config\/ and if   ## they have a .tmpl file suffix will be loaded. See config.templates above   ## to change, add other suffixes. If adding other suffixes, be sure to update   ## config.templates above to include those suffixes.   ## ref: https:\/\/prometheus.io\/docs\/alerting\/notifications\/   ##      https:\/\/prometheus.io\/docs\/alerting\/notification_examples\/   ##   ## templateFiles: {}  prometheus:   ingress:     hosts:   - prometheus-url-for-our-ms   prometheusSpec:     externalUrl: http:\/\/prometheus-url-for-our-ms<\/code><\/pre>\n<p>\u0417\u0430\u043b\u0438\u0432\u0430\u0435\u043c \u0445\u0435\u043b\u044c\u043c \u0447\u0430\u0440\u0442 \u0441 \u043f\u0440\u043e\u043c\u0435\u0442\u0435\u0435\u043c:<\/p>\n<pre><code>helm upgrade --install kube-prometheus-stack -f ms-awesome-k8s-chart.yml prometheus-community\/kube-prometheus-stack -n monitoring<\/code><\/pre>\n<p>\u0417\u0430\u043b\u0438\u0432\u0430\u0435\u043c \u0447\u0430\u0440\u0442 \u0441\u00a0\u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u043e\u043c.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432\u0441\u0435 \u0445\u043e\u0440\u043e\u0448\u043e, \u0442\u043e \u0432\u00a0\u043d\u0435\u0439\u043c\u0441\u043f\u0435\u0439\u0441\u0435, \u0433\u0434\u0435 \u0437\u0430\u043b\u0438\u0442 \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441, \u0434\u043e\u043b\u0436\u0435\u043d \u043f\u043e\u044f\u0432\u0438\u0442\u0441\u044f \u0440\u0435\u0441\u0443\u0440\u0441 PrometheusRules, \u0441\u00a0\u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0443\u043a\u0430\u0437\u0430\u043d\u043e \u0432\u044b\u0448\u0435. \u0418\u043c\u0435\u043d\u043d\u043e \u044d\u0442\u043e\u0442 \u0440\u0435\u0441\u0443\u0440\u0441 \u0434\u043e\u043b\u0436\u0435\u043d \u0432\u00a0\u0438\u0442\u043e\u0433\u0435 \u043f\u043e\u0434\u043d\u044f\u0442\u044c Prometheus. \u0418\u0434\u0435\u043c \u043f\u043e\u00a0\u0443\u0440\u043b\u0443 Prometheus \u0432\u043e\u00a0\u0432\u043a\u043b\u0430\u0434\u043a\u0443 alerts, \u0442\u0430\u043c \u0434\u043e\u043b\u0436\u0435\u043d \u043f\u043e\u044f\u0432\u0438\u0442\u0441\u044f \u043d\u0430\u0448 \u0430\u043b\u0435\u0440\u0442. \u0412\u00a0\u0441\u043b\u0443\u0447\u0430\u0435, \u0435\u0441\u043b\u0438 \u044d\u0442\u043e\u0433\u043e \u043d\u0435\u00a0\u0441\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c, \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u043b\u0435\u0439\u0431\u043b\u044b\u00a0\u2014 \u0430\u00a0\u0438\u043c\u0435\u043d\u043d\u043e label release. \u0415\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0434\u043e\u043b\u0436\u043d\u043e \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u0442\u044c \u0441\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0443\u043a\u0430\u0437\u0430\u043d\u043e \u0432\u00a0Prometheus \u0432\u00a0\u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0435 ruleSelector. \u0415\u0441\u043b\u0438 \u043e\u043d\u0438 \u043d\u0435\u00a0\u0441\u043e\u0432\u043f\u0430\u0434\u0430\u044e\u0442, \u0442\u043e Prometheus \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0435\u00a0\u043d\u0430\u0439\u0434\u0435\u0442 \u044d\u0442\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u043e.<\/p>\n<p>\u0413\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c \u043e\u0448\u0438\u0431\u043a\u0443, \u0447\u0442\u043e\u0431\u044b \u043c\u0435\u0442\u0440\u0438\u043a\u0430 \u043f\u043e\u043c\u0435\u043d\u044f\u043b\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u0436\u0434\u0435\u043c, \u043f\u043e\u043a\u0430 \u0430\u043b\u0435\u0440\u0442 \u043f\u043e\u043c\u0435\u043d\u044f\u0435\u0442 \u0441\u0432\u043e\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435, \u0438, \u0435\u0441\u043b\u0438 alertmanager \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e, \u043d\u0430\u0441\u043b\u0430\u0436\u0434\u0430\u0435\u043c\u0441\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u043c<\/p>\n<p>p\/s<\/p>\n<p><a href=\"https:\/\/ralphmcneal.com\/prometheus-alertmanager-dynamic-slack-config\/\"><u>\u0412\u00a0\u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u0430\u0445 \u0435\u0441\u0442\u044c \u0441\u0442\u0430\u0442\u044c\u044f<\/u><\/a>, \u043a\u0430\u043a\u00a0\u043f\u0440\u043e\u043a\u0438\u0434\u044b\u0432\u0430\u0442\u044c \u043a\u0430\u043d\u0430\u043b \u0438\u0437\u00a0\u0442\u0435\u043b\u0430 \u0430\u043b\u0435\u0440\u0442\u0430. \u042d\u0442\u0443 \u043e\u043f\u0446\u0438\u044f, \u0435\u0441\u043b\u0438 \u0447\u0435\u0441\u0442\u043d\u043e, \u044f \u043d\u0435\u00a0\u0442\u0435\u0441\u0442\u0438\u043b, \u043d\u043e\u00a0\u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0440\u0430\u0431\u043e\u0447\u0438\u043c. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0435\u0441\u043b\u0438 \u043a\u0442\u043e \u0442\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442 \u0438 \u043d\u0430\u043f\u0438\u0448\u0435\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442, \u0431\u0443\u0434\u0435\u0442 \u043f\u043b\u044e\u0441\u0438\u043a \u0432\u00a0\u043a\u0430\u0440\u043c\u0443 ))<\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \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\/articles\/726464\/\"> https:\/\/habr.com\/ru\/articles\/726464\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0412 \u044d\u0442\u043e\u043c \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u0435 \u044f \u043f\u043e\u0441\u0442\u0430\u0440\u0430\u044e\u0441\u044c \u043e\u043f\u0438\u0441\u0430\u0442\u044c \u043e\u0434\u0438\u043d \u0438\u0437 \u0441\u043f\u043e\u0441\u043e\u0431\u043e\u0432 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u0438 \u0430\u043b\u0435\u0440\u0442\u043e\u0432 \u0432 \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u043d\u043e\u0439 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0435.<\/p>\n<p>\u0412\u00a0\u043d\u0435\u0437\u0430\u043f\u0430\u043c\u044f\u0442\u043d\u044b\u0435 \u0432\u0440\u0435\u043c\u0435\u043d\u0430, \u043a\u043e\u0433\u0434\u0430 \u0435\u0449\u0435 \u043d\u0435\u00a0\u0432\u044b\u0448\u043b\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044f\u044f \u0441\u0435\u0440\u0438\u044f \u00ab\u0412\u043e \u0432\u0441\u0435 \u0442\u044f\u0436\u043a\u0438\u0435\u00bb, \u0430\u043b\u0435\u0440\u0442\u044b \u0447\u0430\u0449\u0435 \u0432\u0441\u0435\u0433\u043e \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0441\u044c \u0432\u00a0\u043e\u0434\u043d\u043e\u043c \u043c\u0435\u0441\u0442\u0435\u00a0\u2014 \u0431\u0443\u0434\u044c \u0442\u043e icinga, zabbix, TICK stack \u0438\u043b\u0438\u00a0\u0442\u043e\u0442\u00a0\u0436\u0435 \u0441\u0430\u043c\u044b\u0439 Prometheus. \u0412\u00a0\u044d\u0442\u043e\u043c \u0435\u0441\u0442\u044c \u0441\u0432\u043e\u0438 \u043f\u043b\u044e\u0441\u044b\u00a0\u2014 \u043c\u043e\u0436\u043d\u043e \u043b\u0435\u0433\u043a\u043e \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u0442\u044c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f, \u0433\u0440\u0435\u043f\u043d\u0443\u0442\u044c \u043d\u0443\u0436\u043d\u044b\u0439 \u0430\u043b\u0435\u0440\u0442, \u043d\u0430\u043a\u0438\u0434\u0430\u0442\u044c CI \u0438 \u0442\u0430\u043a \u0434\u0430\u043b\u0435\u0435. \u041d\u043e\u00a0\u043a\u043e\u0433\u0434\u0430 \u0440\u0435\u0447\u044c \u0437\u0430\u0445\u043e\u0434\u0438\u0442 \u043e\u00a0\u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u043d\u043e\u0439 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430, \u0433\u0434\u0435 \u0431\u0438\u0437\u043d\u0435\u0441 \u043b\u043e\u0433\u0438\u043a\u0430 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0430 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u043c\u0438 \u0441\u0435\u0440\u0432\u0438\u0441\u0430\u043c\u0438,\u00a0\u0431\u044b\u043b\u043e\u00a0\u0431\u044b \u043b\u043e\u0433\u0438\u0447\u043d\u044b\u043c \u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0431\u0438\u0437\u043d\u0435\u0441 \u0430\u043b\u0435\u0440\u0442\u0438\u043d\u0433 \u0432\u00a0\u043a\u043e\u0434\u0435 \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u0430. <\/p>\n<p>\u0427\u0442\u043e\u00a0\u0436, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0435\u043c \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0442\u0430\u043a\u043e\u0439 \u043f\u043e\u0434\u0445\u043e\u0434.<\/p>\n<p>\u0412\u00a0\u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u0430 \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433\u0430 Prometheus\/Alertmanager, \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0443\u0442\u0430\u044f \u0432\u00a0k8s. \u041c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441 \u0442\u043e\u0436\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0432\u00a0k8s. \u041d\u043e\u0442\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438 \u0431\u0443\u0434\u0435\u043c \u0441\u043b\u0430\u0442\u044c \u0432\u00a0Slack.<\/p>\n<p>\u0418\u0442\u0430\u043a \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u043c.<\/p>\n<p>\u0427\u0442\u043e\u0431\u044b \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0442\u0435\u043b\u043e \u0430\u043b\u0435\u0440\u0442\u0430 \u0440\u044f\u0434\u043e\u043c \u0441\u00a0\u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u043e\u043c, \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u0440\u0435\u0441\u0443\u0440\u0441\u043e\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f <a href=\"https:\/\/github.com\/prometheus-operator\/kube-prometheus\/blob\/main\/manifests\/prometheus-prometheusRule.yaml\">PrometheusRule<\/a>. <\/p>\n<p>\u0414\u043e\u0431\u0430\u0432\u0438\u043c \u0432\u00a0values \u043d\u0430\u0448\u0435\u0433\u043e \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u0430 \u043d\u0443\u0436\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0438 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043f\u0440\u0430\u0432\u0438\u043b\u043e \u0432\u00a0\u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438 \u0441\u00a0\u0445\u0435\u043b\u044c\u043c \u0447\u0430\u0440\u0442\u043e\u043c:<\/p>\n<pre><code>{{- if .Values.prometheusRule.enabled }} --- apiVersion: monitoring.coreos.com\/v1 kind: PrometheusRule metadata:   labels:     {{- include \"ms-awesome.labels\" . | indent 4 }}     release: {{ .Values.prometheusRule.release |default(\"kube-prometheus-stack\") }}   name: ms-awesome-rule spec:   groups:     - name: ms-awesome-alerts       rules:        - alert: ms-awesome-alert          expr: test_metric{kubernetes_pod_name=~\"ms-awesome.*\"} == 1          for: 20s          labels:            severity: critical            product: \"{{ .Values.alert_info.product }}\"          annotations:            description: 'Test header in ms-awesome alert'            summary: 'This is test alert from ms-awesome' {{- end }}<\/code><\/pre>\n<p>\u0414\u0430\u043b\u0435\u0435 \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u043c Prometheus \u0438 Alertmanager. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u0441\u044f \u0447\u0430\u0440\u0442\u043e\u043c kube-prometheus-stack. \u041d\u0430\u0441\u0442\u0440\u043e\u0438\u043c \u043e\u0442\u043f\u0440\u0430\u0432\u043a\u0443 \u0430\u043b\u0435\u0440\u0442\u043e\u0432 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 label product:<\/p>\n<pre><code>ms-awesome-k8s-chart.yml --- ## Alertmanager configuration directives ## ref: https:\/\/prometheus.io\/docs\/alerting\/configuration\/#configuration-file ##      https:\/\/prometheus.io\/webtools\/alerting\/routing-tree-editor\/  alertmanager:   enabled: true   ## Api that prometheus will use to communicate with alertmanager. Possible values are v1, v2   ##   apiVersion: v2    alertmanagerSpec:     externalUrl: http:\/\/prometheus-url-for-our-ms\/prometheus\/alerts?search=    ## Service account for Alertmanager to use.   ## ref: https:\/\/kubernetes.io\/docs\/tasks\/configure-pod-container\/configure-service-account\/   ##   serviceAccount:     create: true     name: \"\"     annotations: {}    ## Configure pod disruption budgets for Alertmanager   ## ref: https:\/\/kubernetes.io\/docs\/tasks\/run-application\/configure-pdb\/#specifying-a-poddisruptionbudget   ## This configuration is immutable once created and will require the PDB to be deleted to be changed   ## https:\/\/github.com\/kubernetes\/kubernetes\/issues\/45398   ##   podDisruptionBudget:     enabled: false     minAvailable: 1     maxUnavailable: \"\"    config:     global:       resolve_timeout: 5m       slack_api_url: 'https:\/\/hooks.slack.com\/services\/awesome-link-for-alerts-channel'     templates:       - '\/etc\/alertmanager\/config\/*.tmpl'     route:       group_by: ['alertname', 'cluster', 'namespace']       group_wait: 30s       group_interval: 1m       repeat_interval: 1m       receiver: 'blackhole'       routes:         - receiver: \"default-receiver\"           matchers:             - severity =~ \"critical\"           continue: true         - receiver: \"ms-awesome-receiver\"           matchers:             - product = \"ms-awesome\"             - severity =~ \"warning|critical\"           continue: true      receivers:       - name: 'blackhole'       - name: 'default-receiver'       - name: 'ms-awesome-receiver'         slack_configs:           - channel: '{{ index ((index .Alerts 0).Labels) \"slack_channel_monitoring\" }}'             color: \"{{ if eq .Status `firing` }}#000080{{ else }}good{{ end }}\"             title: '{{ if eq .Status `firing` }}:scream:{{ else }}:heavy_check_mark:{{ end }} [{{ .Status | toUpper }}] {{ .Annotations.description }}'             text: '{{ .Annotations.summary }}'   tplConfig: false    ## Alertmanager template files to format alerts   ## By default, templateFiles are placed in \/etc\/alertmanager\/config\/ and if   ## they have a .tmpl file suffix will be loaded. See config.templates above   ## to change, add other suffixes. If adding other suffixes, be sure to update   ## config.templates above to include those suffixes.   ## ref: https:\/\/prometheus.io\/docs\/alerting\/notifications\/   ##      https:\/\/prometheus.io\/docs\/alerting\/notification_examples\/   ##   ## templateFiles: {}  prometheus:   ingress:     hosts:   - prometheus-url-for-our-ms   prometheusSpec:     externalUrl: http:\/\/prometheus-url-for-our-ms<\/code><\/pre>\n<p>\u0417\u0430\u043b\u0438\u0432\u0430\u0435\u043c \u0445\u0435\u043b\u044c\u043c \u0447\u0430\u0440\u0442 \u0441 \u043f\u0440\u043e\u043c\u0435\u0442\u0435\u0435\u043c:<\/p>\n<pre><code>helm upgrade --install kube-prometheus-stack -f ms-awesome-k8s-chart.yml prometheus-community\/kube-prometheus-stack -n monitoring<\/code><\/pre>\n<p>\u0417\u0430\u043b\u0438\u0432\u0430\u0435\u043c \u0447\u0430\u0440\u0442 \u0441\u00a0\u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u043e\u043c.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0432\u0441\u0435 \u0445\u043e\u0440\u043e\u0448\u043e, \u0442\u043e \u0432\u00a0\u043d\u0435\u0439\u043c\u0441\u043f\u0435\u0439\u0441\u0435, \u0433\u0434\u0435 \u0437\u0430\u043b\u0438\u0442 \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441, \u0434\u043e\u043b\u0436\u0435\u043d \u043f\u043e\u044f\u0432\u0438\u0442\u0441\u044f \u0440\u0435\u0441\u0443\u0440\u0441 PrometheusRules, \u0441\u00a0\u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0443\u043a\u0430\u0437\u0430\u043d\u043e \u0432\u044b\u0448\u0435. \u0418\u043c\u0435\u043d\u043d\u043e \u044d\u0442\u043e\u0442 \u0440\u0435\u0441\u0443\u0440\u0441 \u0434\u043e\u043b\u0436\u0435\u043d \u0432\u00a0\u0438\u0442\u043e\u0433\u0435 \u043f\u043e\u0434\u043d\u044f\u0442\u044c Prometheus. \u0418\u0434\u0435\u043c \u043f\u043e\u00a0\u0443\u0440\u043b\u0443 Prometheus \u0432\u043e\u00a0\u0432\u043a\u043b\u0430\u0434\u043a\u0443 alerts, \u0442\u0430\u043c \u0434\u043e\u043b\u0436\u0435\u043d \u043f\u043e\u044f\u0432\u0438\u0442\u0441\u044f \u043d\u0430\u0448 \u0430\u043b\u0435\u0440\u0442. \u0412\u00a0\u0441\u043b\u0443\u0447\u0430\u0435, \u0435\u0441\u043b\u0438 \u044d\u0442\u043e\u0433\u043e \u043d\u0435\u00a0\u0441\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c, \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u043b\u0435\u0439\u0431\u043b\u044b\u00a0\u2014 \u0430\u00a0\u0438\u043c\u0435\u043d\u043d\u043e label release. \u0415\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0434\u043e\u043b\u0436\u043d\u043e \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u0442\u044c \u0441\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0443\u043a\u0430\u0437\u0430\u043d\u043e \u0432\u00a0Prometheus \u0432\u00a0\u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0435 ruleSelector. \u0415\u0441\u043b\u0438 \u043e\u043d\u0438 \u043d\u0435\u00a0\u0441\u043e\u0432\u043f\u0430\u0434\u0430\u044e\u0442, \u0442\u043e Prometheus \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0435\u00a0\u043d\u0430\u0439\u0434\u0435\u0442 \u044d\u0442\u043e \u043f\u0440\u0430\u0432\u0438\u043b\u043e.<\/p>\n<p>\u0413\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u043c \u043e\u0448\u0438\u0431\u043a\u0443, \u0447\u0442\u043e\u0431\u044b \u043c\u0435\u0442\u0440\u0438\u043a\u0430 \u043f\u043e\u043c\u0435\u043d\u044f\u043b\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u0436\u0434\u0435\u043c, \u043f\u043e\u043a\u0430 \u0430\u043b\u0435\u0440\u0442 \u043f\u043e\u043c\u0435\u043d\u044f\u0435\u0442 \u0441\u0432\u043e\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435, \u0438, \u0435\u0441\u043b\u0438 alertmanager \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043d \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e, \u043d\u0430\u0441\u043b\u0430\u0436\u0434\u0430\u0435\u043c\u0441\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u043c<\/p>\n<p>p\/s<\/p>\n<p><a href=\"https:\/\/ralphmcneal.com\/prometheus-alertmanager-dynamic-slack-config\/\"><u>\u0412\u00a0\u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u0430\u0445 \u0435\u0441\u0442\u044c \u0441\u0442\u0430\u0442\u044c\u044f<\/u><\/a>, \u043a\u0430\u043a\u00a0\u043f\u0440\u043e\u043a\u0438\u0434\u044b\u0432\u0430\u0442\u044c \u043a\u0430\u043d\u0430\u043b \u0438\u0437\u00a0\u0442\u0435\u043b\u0430 \u0430\u043b\u0435\u0440\u0442\u0430. \u042d\u0442\u0443 \u043e\u043f\u0446\u0438\u044f, \u0435\u0441\u043b\u0438 \u0447\u0435\u0441\u0442\u043d\u043e, \u044f \u043d\u0435\u00a0\u0442\u0435\u0441\u0442\u0438\u043b, \u043d\u043e\u00a0\u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0440\u0430\u0431\u043e\u0447\u0438\u043c. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0435\u0441\u043b\u0438 \u043a\u0442\u043e \u0442\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442 \u0438 \u043d\u0430\u043f\u0438\u0448\u0435\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442, \u0431\u0443\u0434\u0435\u0442 \u043f\u043b\u044e\u0441\u0438\u043a \u0432\u00a0\u043a\u0430\u0440\u043c\u0443 ))<\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \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\/articles\/726464\/\"> https:\/\/habr.com\/ru\/articles\/726464\/<\/a><br \/><\/br><\/br><\/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-396450","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/396450","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=396450"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/396450\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=396450"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=396450"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=396450"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}