Skip to content

Notifier Email

Todd Palino edited this page Jul 22, 2020 · 7 revisions

The "email" notifier module responds to consumer group status evaluations and sends emails to a configured address.

Configuration

The subheading must be a unique name, such as [notifier.tellme]. The "tellme" part is the name that will be used when logging. The configs specified below are in addition to the ones specified for all notifiers on the Configuration page.

[notifier.tellme]
class-name="email"
interval=30
threshold=3
group-allowlist="^important-group-prefix.*$"
group-denylist="^not-this-group$"
extras={ key1="value1", key2="value2" }
send-close=true
template-open="path/to/file1.tmpl"
template-close="path/to/file2.tmpl"
Key Value Type Required Default Value Description
class-name string yes (empty) This is the name of the notifier module type. For this module, it must be "email"
interval integer no 60 The number of seconds to wait between sending notifications for a single group.
threshold integer no 2 The minimum group status to send out notifications for (refer to StatusConstant for values).
group-allowlist string (regex) no (empty) If specified, only send notifications for groups that match this regular expression.
group-denylist string (regex) no (empty) If specified, only send notifications for groups that DO NOT match this regular expression. This is processed after the allowlist (if specified).
extras map (string -> string) no (empty) A map of values that will be available when compiling the template for the message to send.
send-close boolean no false If true, use the template-close template to send a notification when the group status drops to OK (after it has been WARN or above).
template-open path yes (empty) The path and filename of a template file that is used to compile the message to send for groups that pass the whitelist and status threshold (see Templates for more information on building the template).
template-close path no (empty) The path and filename of a template file that is used to compile the message to send for groups that transition to OK (if send-close is true).
server string yes (empty) The fully-qualified hostname of the SMTP server to connect to for sending mail.
port integer yes (none) The port number to connect to on the SMTP server. The mailer will automatically detect if TLS can be used.
from string yes (empty) The email address to send messages from.
to string yes (empty) The email address to send messages to.
auth-type string no (empty) If specified, authenticate to the SMTP server. This can be empty, "plain", or "crammd5".
username string no (empty) The username to use for authentication, if auth-type is not empty.
password string no (empty) The password to use for authentication, if auth-type is not empty.

Template Usage

The templates are used to make up the message body, but it is important to know that they assume that the first line will be the email subject. This means that all templates used for email should have a subject header specified as the first line, followed by a blank line:

Subject: Burrow found a problem!

Burrow found a problem with one of your consumer groups
...

Or utilizing detailed variables supplied to the template:

Subject: [Burrow] Kafka Consumer Lag Alert

The Kafka consumer groups you are monitoring are currently showing problems. The following groups are in a problem state (groups not listed are OK):

Cluster:  {{.Result.Cluster}}
Group:    {{.Result.Group}}
Status:   {{if eq 1 .Result.Status}}OK{{else if eq 1 .Result.Status}}WARNING{{else if eq 2 .Result.Status}}ERROR{{end}}
Complete: {{.Result.Complete}}
Errors:   {{len .Result.Partitions}} partitions have problems
{{range .Result.Partitions}}          {{if eq 1 .Status}}   OK{{if eq 2 .Status}} WARN{{else if eq 2 .Status}}  ERR{{else if eq 3 .Status}} STOP{{else if eq 4 .Status}}STALL{{end}} {{.Topic}}:{{.Partition}} ({{.Start.Timestamp}}, {{.Start.Offset}}, {{.Start.Lag}}) -> ({{.End.Timestamp}}, {{.End.Offset}}, {{.End.Lag}})
{{end}}{{end}}

This also means that you can specify additional mail headers before the blank line, if needed. For example, you could send an email with embedded html like so:

Subject: Burrow found a problem!
MIME-version: 1.0;
Content-Type: text/html; charset=UTF-8;

<html>
</head>
<body>
<h1> Burrow found a problem with one of your consumer groups </h1>
</body>
</html>

For further details on creating templates for notifiers, please see the Templates page.