I created the pod_down alert rule and this is my query:
sum by(namespace,pod) (changes(kube_pod_status_ready{condition="true"}[5m]))
2. alert rule classic conditiion
3. alert rule message template
I want to pass pod_name into the alert message template.
pod= nginx-3yh536hs-kd pod was down
environment = dev
namespace = default
summary = pod_down alert rule.
@markalex So, I found the simple template and tried it for the discord alert message (Contact points) but still, I can't get the correct output
template
{{ define "default_template" }}
**[{{ index .Annotations "summary" }}]**
**Environment:** {{ index .Labels "environment" }}
**Pod:** {{ index .Labels "pod" }}
**Type:** {{ index .Labels "type" }}
**Error Message:**
{{ .Annotations.summary }}
{{ end }}
discord alert message
**[
[RESOLVED] Pod Down Alert Development (postgresql-backup dev postgresql-backup k8s)
Grafana v10.1.5
Spidey Bot
BOT
— Today at 10:07 AM
**[
[FIRING:1] (TestAlert Grafana)
Grafana v10.1.5
Finally, I got my correct alert message template.
Pod CPU high alert
alert condition image
Add Summary into anntations
and save rule and exit
create default message template.
output discord alert message