Use Grafana configuration values in alerting

I’m currently looking into using Grafana configuration values like instance_name or metrics.environment_info labels (all specified in grafana.ini config file) as part of my eMail alert.

The Grot search bot on Grafana labs suggested using
{{.InstanceName}} or {{.EnvironmentInfo.<variable_name>}} to use in the alert template,
but when I run this, I get the following exception:

template: :1:2: executing “” at <.InstanceName>: can’t evaluate field InstanceName in type *templates.ExtendedData

Is the search bot wrong or do I something wrong?
I’m using Grafana 10.2.3

Any help appreciated!

I think the chat bot is giving incomplete information. You need to iterate over the alerts and then access the labels. Please look at the examples in the docs Using Go's templating language | Grafana documentation

Thanks for the hint. I did try that, but it looks like Grafana does not provide that kind of information as a label during alert evaluation.