Update Kubernetes Services Wiki / Generate and Update K8s Wiki (push) Successful in 29s
61 lines
3.5 KiB
YAML
61 lines
3.5 KiB
YAML
apiVersion: monitoring.coreos.com/v1alpha1
|
|
kind: AlertmanagerConfig
|
|
metadata:
|
|
name: telegram
|
|
labels:
|
|
alertmanager: main
|
|
annotations:
|
|
argocd.argoproj.io/sync-wave: "1"
|
|
spec:
|
|
route:
|
|
groupBy: [cluster, namespace, alertname]
|
|
# A two-minute grace period absorbs alerts which resolve immediately and
|
|
# never need to interrupt a human.
|
|
groupWait: 2m
|
|
groupInterval: 10m
|
|
repeatInterval: 12h
|
|
receiver: telegram
|
|
routes:
|
|
- receiver: "null"
|
|
matchers:
|
|
- name: alertname
|
|
value: Watchdog|InfoInhibitor
|
|
matchType: =~
|
|
# Informational alerts remain queryable in Prometheus but do not page the
|
|
# Telegram chat. Warning and critical alerts still use the parent route.
|
|
- receiver: "null"
|
|
matchers:
|
|
- name: severity
|
|
value: info
|
|
matchType: =
|
|
receivers:
|
|
- name: telegram
|
|
telegramConfigs:
|
|
- botToken:
|
|
name: alertmanager-telegram
|
|
key: bot-token
|
|
# Telegram chat IDs are routing identifiers rather than credentials;
|
|
# AlertmanagerConfig only supports an integer here, not a Secret ref.
|
|
chatID: 124317807
|
|
sendResolved: true
|
|
parseMode: HTML
|
|
message: |-
|
|
{{ if eq .Status "firing" }}🔥 <b>FIRING · {{ len .Alerts.Firing }}</b>{{ else }}✅ <b>RESOLVED · {{ len .Alerts.Resolved }}</b>{{ end }}
|
|
{{ with .CommonLabels.alertname }}<b>{{ . | reReplaceAll "&" "&" | reReplaceAll "<" "<" | reReplaceAll ">" ">" }}</b>{{ end }}{{ with .CommonLabels.severity }} · <code>{{ . | reReplaceAll "&" "&" | reReplaceAll "<" "<" | reReplaceAll ">" ">" }}</code>{{ end }}
|
|
{{ range .Alerts }}
|
|
|
|
{{ if eq .Status "firing" }}🔴{{ else }}🟢{{ end }} {{ with .Annotations.summary }}<b>{{ . | reReplaceAll "&" "&" | reReplaceAll "<" "<" | reReplaceAll ">" ">" }}</b>{{ else }}<b>{{ .Labels.alertname | reReplaceAll "&" "&" | reReplaceAll "<" "<" | reReplaceAll ">" ">" }}</b>{{ end }}
|
|
{{ with .Annotations.description }}{{ . | reReplaceAll "&" "&" | reReplaceAll "<" "<" | reReplaceAll ">" ">" }}{{ end }}
|
|
{{ if or .Labels.namespace .Labels.pod .Labels.container .Labels.node .Labels.instance }}
|
|
<b>Context</b>
|
|
{{ with .Labels.namespace }}Namespace: <code>{{ . | reReplaceAll "&" "&" | reReplaceAll "<" "<" | reReplaceAll ">" ">" }}</code>{{ end }}
|
|
{{ with .Labels.pod }}Pod: <code>{{ . | reReplaceAll "&" "&" | reReplaceAll "<" "<" | reReplaceAll ">" ">" }}</code>{{ end }}
|
|
{{ with .Labels.container }}Container: <code>{{ . | reReplaceAll "&" "&" | reReplaceAll "<" "<" | reReplaceAll ">" ">" }}</code>{{ end }}
|
|
{{ with .Labels.node }}Node: <code>{{ . | reReplaceAll "&" "&" | reReplaceAll "<" "<" | reReplaceAll ">" ">" }}</code>{{ end }}
|
|
{{ if and (not .Labels.node) .Labels.instance }}Instance: <code>{{ .Labels.instance | reReplaceAll "&" "&" | reReplaceAll "<" "<" | reReplaceAll ">" ">" }}</code>{{ end }}
|
|
{{ end }}
|
|
Started: {{ .StartsAt | tz "Europe/London" | date "2006-01-02 15:04 MST" }}
|
|
<a href="{{ .GeneratorURL | reReplaceAll "&" "&" | reReplaceAll "<" "<" | reReplaceAll ">" ">" }}">📈 Open graph</a>{{ with .Annotations.runbook_url }} · <a href="{{ . | reReplaceAll "&" "&" | reReplaceAll "<" "<" | reReplaceAll ">" ">" }}">📖 Runbook</a>{{ end }}
|
|
{{ end }}
|
|
- name: "null"
|