Stats

88 Contributors: 2
2016-07-21
Licensed under: CC-BY-SA

Not affiliated with Stack Overflow
Rip Tutorial: info@zzzprojects.com

Download eBook

Templates: Overview

Download bosun eBook

Syntax

  • #See https://golang.org/pkg/text/template/ for Go Template Action and Function syntax
  • expression = alert status {{.Last.Status}} and a variable {{.Eval .Alert.Vars.q | printf "%.2f"}}
  • expression = `Use backticks to span
  • multiple lines with line breaks
  • in the Bosun config file`
  • template name {
    • subject = expression
    • body = expression
  • }

Remarks

Bosun templates are based on the Go html/template package and can be shared across multiple alerts, but a single template is used to render all Bosun Notifications for that alert. Alerts reference which template to use via the template directive and specify which notifications to use via the warnNotification and critNotification directives (can have multiple warn/crit notifications defined for each alert).

Templates are rendered when an alert instance is triggered and can:

The template subject will be displayed as headers on the dashboard, as the subject line of email notifications, and as the default contents of HTTP POST notifications. The template body will be displayed when an alert instance is expanded and as the body of email notifications.

Related Examples