flux-charts/infra-monitoring/templates/alertmanager/alertmanager-config.yaml

123 lines
3.5 KiB
YAML

{{- if (.Capabilities.APIVersions.Has "monitoring.coreos.com/v1alpha1/AlertmanagerConfig") }}
---
apiVersion: "monitoring.coreos.com/v1alpha1"
kind: "AlertmanagerConfig"
metadata:
name: "global-alertmanager-conf"
spec:
receivers:
- name: "null"
{{- with .Values.alertmanager.receiver.ntfy }}
{{- if .enabled }}
- name: "ntfy-default"
webhookConfigs:
- url: "http://alertmanager-ntfy"
sendResolved: {{ .sendResolved }}
{{- if and .enabled (.config.user) }}
httpConfig:
basicAuth:
username:
name: global-alertmanager-ntfy-auth
key: username
password:
name: global-alertmanager-ntfy-auth
key: password
{{- end }}
{{- end }}
{{- end }}
{{- with .Values.alertmanager.receiver.matrix }}
{{- if .enabled }}
- name: "matrix-default"
webhookConfigs:
- url: "http://alertmanager-matrix:4051/{{ .default }}"
sendResolved: {{ .sendResolved }}
{{- range $receiver, $conf := .rooms }}
- name: "matrix-{{ $receiver }}"
webhookConfigs:
- url: "http://alertmanager-matrix:4051/{{ $conf.room }}"
sendResolved: {{ $conf.sendResolved }}
{{- end }}
{{- end }}
{{- end }}
inhibitRules:
- sourceMatch:
- name: "alertmanagerInhibitDisable"
matchType: "!="
value: "true"
- name: "severity"
matchType: "="
value: "critical"
targetMatch:
- name: "alertmanagerInhibitDisable"
matchType: "!="
value: "true"
- name: "severity"
matchType: "=~"
value: "warning|info"
equal:
- "namespace"
- "alertname"
- sourceMatch:
- name: "alertmanagerInhibitDisable"
matchType: "!="
value: "true"
- name: "severity"
matchType: "="
value: "warning"
targetMatch:
- name: "alertmanagerInhibitDisable"
matchType: "!="
value: "true"
- name: "severity"
matchType: "="
value: "info"
equal:
- "namespace"
- "alertname"
- sourceMatch:
- name: "alertmanagerInhibitDisable"
matchType: "!="
value: "true"
- name: "alertname"
matchType: "="
value: "InfoInhibitor"
targetMatch:
- name: "alertmanagerInhibitDisable"
matchType: "!="
value: "true"
- name: "severity"
matchType: "="
value: "info"
equal:
- "namespace"
{{- with .Values.alertmanager.inhibitRules }}
{{- toYaml . | nindent 4 }}
{{- end }}
route:
groupWait: "30s"
groupInterval: "10m"
groupBy:
- "namespace"
receiver: "null"
repeatInterval: {{ .Values.alertmanager.receiver.repeatInterval }}
routes:
- receiver: "null"
matchers:
- name: "alertname"
matchType: "=~"
value: "InfoInhibitor|Watchdog"
{{- with .Values.alertmanager.receiver.routes }}
{{- toYaml . | nindent 6 }}
{{- else }}
{{- with .Values.alertmanager.receiver }}
{{- if .ntfy.enabled }}
- receiver: "ntfy-default"
continue: true
{{- end }}
{{- if .matrix.enabled }}
- receiver: "matrix-default"
continue: true
{{- end }}
{{- end }}{{/* end-with receiver */}}
{{- end }}{{/* end-with routes */}}
{{- end }}