grafana / grafana

The open and composable observability and data visualization platform. Visualize metrics, logs, and traces from multiple sources like Prometheus, Loki, Elasticsearch, InfluxDB, Postgres and many more.
https://grafana.com
GNU Affero General Public License v3.0
63.86k stars 11.95k forks source link

Alerting: Image renderer screenshots cannot be used in custom templates #89874

Open Desolar1um opened 2 months ago

Desolar1um commented 2 months ago

What happened?

Using a custom alerting notification template for E-mail does not include image renderer screenshots

Example default template output: image

Example custom template output: image

What did you expect to happen?

Alert emails include panel screenshots

Did this work before?

No

How do we reproduce it?

  1. Set up image renderer as a separate docker container
  2. Create custom alert template
  3. Create an alert panel and trigger an alert

Is the bug inside a dashboard panel?

No response

Environment (with versions)?

Grafana: v10.3.3 On K8s

Grafana platform?

Kubernetes

Datasource(s)?

No response

tonypowa commented 1 month ago

hi @Desolar1um

Could you please provide the custom template you are using (with any sensitive information redacted)?

Thank you

Desolar1um commented 1 month ago

Hello @tonypowa, Thanks for your time. I've included my current template below

{{- define "email.message_alert" -}}

{{ .Labels.alertname }}

{{ range .Annotations.SortedPairs }}
{{ .Name }}:
{{ .Value }}
{{ end }}
{{- end -}}

{{ define "email.message" }}

{{ if .Alerts.Firing -}}
{{ len .Alerts.Firing }} Firing
{{- range .Alerts.Firing }}
- {{ template "email.message_alert" . }}

Annotations:
{{ range .Annotations.SortedPairs }}- {{ .Name }} = {{ .Value }}
{{ end }}{{ if gt (len .SilenceURL) 0 }}- Silence: {{ .SilenceURL }}
{{ end }}{{ if gt (len .DashboardURL) 0 }}- Dashboard: {{ .DashboardURL }}
{{ end }}{{ if gt (len .PanelURL) 0 }}- Panel: {{ .PanelURL }}
{{ end }}{{ if gt (len .Annotations.alertUid) 0 }}- Alert: https://<redacted>/alerting/grafana/{{ .Annotations.alertUid }}/view?returnTo=%2Falerting%2Flist
{{ end }}
{{- end }}
{{- end }}

{{ if .Alerts.Resolved -}}
{{ len .Alerts.Resolved }} Resolved
{{- range .Alerts.Resolved }} {{ template "email.message_alert" . }}
Annotations:
{{ range .Annotations.SortedPairs }}- {{ .Name }} = {{ .Value }}
{{ end }}{{ if gt (len .SilenceURL) 0 }}- Silence: {{ .SilenceURL }}
{{ end }}{{ if gt (len .DashboardURL) 0 }}- Dashboard: {{ .DashboardURL }}
{{ end }}{{ if gt (len .PanelURL) 0 }}- Panel: {{ .PanelURL }}
{{ end }}{{ if gt (len .Annotations.alertUid) 0 }}- Alert: https://<redacted>/alerting/grafana/{{ .Annotations.alertUid }}/view?returnTo=%2Falerting%2Flist
{{ end }}
{{- end }}
{{- end }}

{{ end }}
Desolar1um commented 1 month ago

Any finding here? @tonypowa

Desolar1um commented 1 week ago

Any finding here? @tonypowa

tonypowa commented 1 week ago

Hi @Desolar1um The issue is already added to the team's board Thank you your patience