Alert templating *({{.Labels.severity | toUpper }}) fails when you don't have severity in alert rules into a string.
Example:
- alert: High Node CPU Usage
annotations:
summary: Example summary
expr: |
<Example Expr>
for: 5m
labels:
team: devops
severity: "critical"
This will pass but
- alert: High Node CPU Usage
annotations:
summary: Example summary
expr: |
<Example Expr>
for: 5m
labels:
team: devops
severity: critical # without quotes
This fails with msg="Error parsing values in template" error="template: message.tmpl:1:23: executing \"message.tmpl\" at <toUpper>: invalid value; expected string"
Alert templating
*({{.Labels.severity | toUpper }})
fails when you don't haveseverity
in alert rules into a string.Example:
This will pass but
This fails with
msg="Error parsing values in template" error="template: message.tmpl:1:23: executing \"message.tmpl\" at <toUpper>: invalid value; expected string"