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") }}
8 name: {{ printf "%s-%s" (include "prometheus-operator.fullname" .) "alertmanager.rules" | trunc 63 | trimSuffix "-" }}
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 }}
15 {{- if .Values.defaultRules.annotations }}
17 {{ toYaml .Values.defaultRules.annotations | indent 4 }}
21 - name: alertmanager.rules
23 - alert: AlertmanagerConfigInconsistent
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
30 - alert: AlertmanagerFailedReload
32 message: Reloading Alertmanager's configuration has failed for {{`{{ $labels.namespace }}`}}/{{`{{ $labels.pod}}`}}.
33 expr: alertmanager_config_last_reload_successful{job="{{ $alertmanagerJob }}"} == 0
37 - alert: AlertmanagerMembersInconsistent
39 message: Alertmanager has not found all other members of the cluster.
41 alertmanager_cluster_members{job="{{ $alertmanagerJob }}"}
42 != on (service) GROUP_LEFT()
43 count by (service) (alertmanager_cluster_members{job="{{ $alertmanagerJob }}"})