Fix Collection Service Helm charts package
[demo.git] / vnfs / DAaaS / prometheus-operator / templates / alertmanager / rules / alertmanager.rules.yaml
1 # Generated from 'alertmanager.rules' group from https://raw.githubusercontent.com/coreos/prometheus-operator/master/contrib/kube-prometheus/manifests/prometheus-rules.yaml
2 {{- if and .Values.defaultRules.create }}
3 {{- $operatorJob := printf "%s-%s" (include "prometheus-operator.fullname" .) "operator" }}
4 {{- $alertmanagerJob := printf "%s-%s" (include "prometheus-operator.fullname" .) "alertmanager" }}
5 apiVersion: {{ printf "%s/v1" (.Values.prometheusOperator.crdApiGroup | default "monitoring.coreos.com") }}
6 kind: PrometheusRule
7 metadata:
8   name: {{ printf "%s-%s" (include "prometheus-operator.fullname" .) "alertmanager.rules" | trunc 63 | trimSuffix "-" }}
9   labels:
10     app: {{ template "prometheus-operator.name" . }}
11 {{ include "prometheus-operator.labels" . | indent 4 }}
12 {{- if .Values.defaultRules.labels }}
13 {{ toYaml .Values.defaultRules.labels | indent 4 }}
14 {{- end }}
15 {{- if .Values.defaultRules.annotations }}
16   annotations:
17 {{ toYaml .Values.defaultRules.annotations | indent 4 }}
18 {{- end }}
19 spec:
20   groups:
21   - name: alertmanager.rules
22     rules:
23     - alert: AlertmanagerConfigInconsistent
24       annotations:
25         message: The configuration of the instances of the Alertmanager cluster `{{`{{$labels.service}}`}}` are out of sync.
26       expr: count_values("config_hash", alertmanager_config_hash{job="{{ $alertmanagerJob }}"}) BY (service) / ON(service) GROUP_LEFT() label_replace(prometheus_operator_spec_replicas{job="{{ $operatorJob }}",controller="alertmanager"}, "service", "alertmanager-$1", "name", "(.*)") != 1
27       for: 5m
28       labels:
29         severity: critical
30     - alert: AlertmanagerFailedReload
31       annotations:
32         message: Reloading Alertmanager's configuration has failed for {{`{{ $labels.namespace }}`}}/{{`{{ $labels.pod}}`}}.
33       expr: alertmanager_config_last_reload_successful{job="{{ $alertmanagerJob }}"} == 0
34       for: 10m
35       labels:
36         severity: warning
37     - alert: AlertmanagerMembersInconsistent
38       annotations:
39         message: Alertmanager has not found all other members of the cluster.
40       expr: |-
41         alertmanager_cluster_members{job="{{ $alertmanagerJob }}"}
42           != on (service) GROUP_LEFT()
43         count by (service) (alertmanager_cluster_members{job="{{ $alertmanagerJob }}"})
44       for: 5m
45       labels:
46         severity: critical
47 {{- end }}