Hi folks.
I was wondering if anyone came around something like this. I have an alert
in alertmanager which has a Go template like this:
- alert: Critical
annotations:
description: 'Blablabla (pod:
({{$labels.namespace}}/{{$labels.pod}})), it has a current value: {{ $value
| humanize }}.'
expr: <whatever>
for: 5m
labels:
severity: '{{- if match "bla-" $labels.namespace }} error {{- else
-}} critical {{- end -}}'
category: '{{- if match "bla-" $labels.namespace }} deployment {{-
else -}} infrastructure {{- end -}}'
server_id: '{{ if match "bla-" $labels.namespace }} {{ reReplaceAll
"bla-(.*)" "$1" $labels.namespace }} {{- else -}} {{- end -}}'
What happens is that the whole thing in severity, category and server_id is
just being displayed as is. Like it was just a string and not a Go
template. while the templating in description is working perfectly fine.
What's wrong here? Is some kind of config missing from somewhere? Is the
syntax incorrect? I did try '{{ `{{...}}` }}' as well, but no cigar.
--
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/fd91c1bf-0b74-47e5-9032-80426cb5cca8n%40googlegroups.com.