Embedded graphs in email alerts


Can someone please provide some pointers on embedding panel images in email alerts? Grafana 9.3.2 self hosted FOSS.

I have image renderer plugin installed and working. Using the default template, the image is inserted into the email alert body as expected. When using custom templates, I can’t work out the syntax to embed the image. The image is still rendered (capture = true) in grafana.ini, but the image is only sent with the alert as an attachment.

Looking at the ng_alert_notification.html file, it appears I need to use

{{ if ne .EmbeddedImage "" }}
  <img src="cid:{{.EmbeddedImage}}" />
{{ end }}

however, using this breaks the alert output (just the grafana logo, no image, or no values from template file which works fine when the {{embeddedImage}} code is removed. The template editor doesn’t fail when saving the template.

I have read through the templating docs and use image in notifications doc, but can’t find anything about how to embed in a custom template. Use images in notifications | Grafana documentation

Any help with this would be greatly appreciated


(post deleted by author)

@georgerobinson could you perhaps have some input on this?

Hi! It’s not possible to change how and where images are embedded with templates I’m afraid. The reason for this is that there is different levels of support for embedding images across integrations, but templates work irrespective of integration. For example, how should {{ .EmbeddedImage }} work when sending an event to Pagerduty or a webhook to a server.