I want to re-use string constant
like
"KubeDeploymentReplicasMismatch|KubeHpaReplicasMismatch|KubePodNotReady|KubeContainerWaiting"
in several Alertmanager template definitions.
let me illustrate by example (I know the below wouldn't work):
{{ $myAlertGroup :=
"KubeDeploymentReplicasMismatch|KubeHpaReplicasMismatch|KubePodNotReady|KubeContainerWaiting"
}}
{{ define "__alert_message_title" -}}
{{ if match .GroupLabels.alertname $myAlertGroup -}}
{{ .CommonAnnotations.message }}
{{- end }}
{{ define "__alert_message_body" -}}
{{ if match .GroupLabels.alertname $myAlertGroup -}}
{{- range .Alerts.Firing }}
• `{{ .Labels.namespace -}}`/`{{ .Labels.pod -}}`
{{- end }}
{{- end }}
Is there a way to achieve this?
It's possible to move variable definition inside {{ define .. }} block but
then I need to define the same value twice, once per template definition. I
want to manage the value in one place.
--
You received this message because you are subscribed to the Google Groups
"Prometheus Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/prometheus-users/d2014d1a-5f79-4007-9c30-8ef6954615ac%40googlegroups.com.