This repository was archived by the owner on Dec 17, 2025. It is now read-only.
Monitor Only report notifications #1806
piksel
started this conversation in
Notification Templates
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
The default report template does not work well with
monitor-only, but here are some alternative ones you can use:Version that always sends a report:
{{- with .Report -}} {{len .Scanned}} Scanned, {{len .Stale}} Stale, {{len .Failed}} Failed {{- range .Stale}} - {{.Name}} ({{.ImageName}}): {{.CurrentImageID.ShortID}} has a new image {{.LatestImageID.ShortID}} {{- end -}} {{- range .Fresh}} - {{.Name}} ({{.ImageName}}): {{.State}} {{- end -}} {{- range .Skipped}} - {{.Name}} ({{.ImageName}}): {{.State}}: {{.Error}} {{- end -}} {{- range .Failed}} - {{.Name}} ({{.ImageName}}): {{.State}}: {{.Error}} {{- end -}} {{- end -}} {{- if (and .Entries .Report) }} Logs: {{ end -}} {{range .Entries -}}{{.Time.Format `2006-01-02T15:04:05Z07:00`}} [{{printf `%5.5s` .Level}}] {{.Message}}{{println}}{{- end -}}Version that only sends notifications when noteworthy1 things happened:
{{- with .Report -}} {{- if ( or .Stale .Failed ) -}} {{len .Scanned}} Scanned, {{len .Stale}} Stale, {{len .Failed}} Failed {{- range .Stale}} - {{.Name}} ({{.ImageName}}): {{.CurrentImageID.ShortID}} has a new image {{.LatestImageID.ShortID}} {{- end -}} {{- range .Fresh}} - {{.Name}} ({{.ImageName}}): {{.State}} {{- end -}} {{- range .Skipped}} - {{.Name}} ({{.ImageName}}): {{.State}}: {{.Error}} {{- end -}} {{- range .Failed}} - {{.Name}} ({{.ImageName}}): {{.State}}: {{.Error}} {{- end -}} {{- end -}} {{- end -}} {{- if (and .Entries .Report (or .Report.Stale .Report.Failed)) }} Logs: {{ end -}} {{- range .Entries -}}{{.Time.Format `2006-01-02T15:04:05Z07:00`}} [{{printf `%5.5s` .Level}}] {{.Message}}{{println}}{{- end -}}See #1807 for an example of how to apply these templates in your
docker-compose.yaml.Footnotes
"Noteworthy" is defined as "Any containers where
stale(has a newer image), or checking for updates for any containers failed", but this can of course be changed by altering the{{- if ( or .Stale .Failed ) -}}condition. Make sure to also make the same change to{{- if (and .Entries .Report (or .Report.Stale .Report.Failed)) }}to skip thelogs:separator text between the summary and log entries when they are not both present. ↩All reactions