Setting up email notifications and extracting valuable info from alerts

Hi,

I’m new here so I don’t know if this is the right place.
I started using Grafana for work about a week ago so I don’t have much experience.
I’m trying to set up notification (for email) for particular alert. What I want to get in an email is the name of the host where problem is happening and the value of metric that I’m monitoring.
I tried many things, looked many tutorials etc. The best thing that I found is to use command:
{{ .Value }}
which gives me something like this:
[metric=‘cpu.usage_idle {cpu: cpu-total host=hostname.somethin}’ labels={cpu=cpu-total, host=hostname.somethin value=90.0000000000001]
Now, I want to extract name of the host from this and that value on the end.
I tried many things, here are some examples:
{{ .ValueString }}
{{ range .Value }}
{{ .Value.labels }}
{{ .Value.labels.host }}
{{ .Value.host }}
{{ .Value[“host”] }}
{{ .Value “host” }}
{{ .Value.value }}
{{ .Value }}{{ $host }}
etc etc
I really don’t know what to do or where to look. Please help.
Thank you.

welcome to the :grafana: forum, @klempoklempic

Can you confirm: are you using the new Unified Alerting platform or the legacy platform?

Hi,

How do I find that out? I choose this first one (other two don’t work)
upload

Probably the new one, because Grafana is version 8.2…

@klempoklempic, yes that is the new Unified Alerting. I am also trying to figure out all the nuances to the alerting templates. This template example has been helpful.

1 Like