Documentation

Email (SMTP) event handler

The Email event handler sends alert messages via SMTP/email.

Configuration

Configuration as well as default option values for the Email event handler are set in the [smtp] section of your kapacitor.conf. Below is an example configuration:

[smtp]
  enabled = true
  host = "localhost"
  port = 25
  username = "username"
  password = "passw0rd"
  from = "me@example.com"
  to = ["me@example.com", "you@example.com"]
  no-verify = false
  idle-timeout = "30s"
  global = false
  state-changes-only = false

enabled

Set to true to enable the SMTP event handler.

host

The SMTP host.

port

The SMTP port.

username

Your SMTP username.

password

Your SMTP password.

from

The “From” address for outgoing mail.

to

List of default “To” addresses.

no-verify

Skip TLS certificate verification when connecting to the SMTP server.

idle-timeout

The time after which idle connections are closed.

global

If true, all alerts will be sent via Email without explicitly specifying the SMTP handler in the TICKscript.

state-changes-only

Sets all alerts in state-changes-only mode, meaning alerts will only be sent if the alert state changes. Only applies if global is true.

Options

The following Email event handler options can be set in a handler file or when using .email() in a TICKscript.

NameTypeDescription
tolist of stringsList of email addresses.
toTemplate(s)string templateDerived email addresses.

Example: handler file

id: handler-id
topic: topic-name
kind: smtp
options:
  to:
    - oncall1@example.com
    - oncall2@example.com

Example: TICKscript

|alert()
  // ...
  .email()
    .to('oncall1@example.com')
    .to('oncall2@example.com')

  // OR
  .email('oncall1@example.com')
    .to('oncall2@example.com')

Using the SMTP/Email event handler

The Email event handler can be used in both TICKscripts and handler files to email alerts. The email subject is the AlertNode.Message property. The email body is the AlertNode.Details property. The emails are sent as HTML emails so the body can contain html markup.

SMTP settings in kapacitor.conf

[smtp]
  enabled = true
  host = "smtp.myserver.com"
  port = 25
  username = "username"
  password = "passw0rd"
  from = "me@emyserver.com"
  to = ["oncall0@mydomain.com"]
  no-verify = false
  idle-timeout = "30s"
  global = false
  state-changes-only = false

Email alerts from a TICKscript

The following TICKscript uses the .email() event handler to send out emails whenever idle CPU usage drops below 10%.

email-cpu-alert.tick

stream
  |from()
    .measurement('cpu')
  |alert()
    .crit(lambda: "usage_idle" < 10)
    .message('Hey, check your CPU')
    .email()
      .to('oncall1@mydomain.com')
      .to('oncall2@mydomain.com')

Email alerts from a defined handler

The following setup sends an alert to the cpu topic with the message, “Hey, check your CPU”. An email handler is added that subscribes to the cpu topic and emails all alerts.

Create a TICKscript that publishes alert messages to a topic. The TICKscript below sends an alert message to the cpu topic any time idle CPU usage drops below 10%.

cpu_alert.tick

stream
  |from()
    .measurement('cpu')
  |alert()
    .crit(lambda: "usage_idle" < 10)
    .message('Hey, check your CPU')
    .topic('cpu')

Add and enable the TICKscript:

kapacitor define cpu_alert -tick cpu_alert.tick
kapacitor enable cpu_alert

Create a handler file that subscribes to the cpu topic and uses the email or smtp event handler to email alerts.

email_cpu_handler.yaml

id: email-cpu-alert
topic: cpu
kind: smtp
options:
  to:
    - oncall1@mydomain.com
    - oncall2@mydomain.com

Add the handler:

kapacitor define-topic-handler email_cpu_handler.yaml

Send email alerts using the toTemplate option

You can use toTemplate to derive email addresses directly from data instead of hardcoding them individually. In the example below, we are using both the to option and toTemplates option in order to derive email addresses from a dataset and send email alerts directly to recipients. Like the to option, the toTemplates option can be used more than once in a TICKscript. You can combine the to and toTemplates options or use them individually depending on your use case.

stream
	|from()
		.measurement('cpu')
		.where(lambda: "host" == 'serverA')
		.groupBy('host')
	|window()
		.period(10s)
		.every(10s)
	|count('value')
	|default()
		.field('extraemail','bob@example.com')
		.tag('tagemail','bob2@example.com')
	|alert()
		.id('kapacitor.{{ .Name }}.{{ index .Tags "host" }}')
		.details('''
<b>{{.Message}}</b>
Value: {{ index .Fields "count" }}
<a href="http://graphs.example.com/host/{{index .Tags "host"}}">Details</a>
''')
		.info(lambda: "count" > 6.0)
		.warn(lambda: "count" > 7.0)
		.crit(lambda: "count" > 8.0)
		.email()
			.to('user1@example.com', 'user2@example.com')
			.toTemplates('{{ index .Fields "extraemail" }}')

Was this page helpful?

Thank you for your feedback!


InfluxDB OSS 2.9.0: API tokens are hashed by default

Stronger token security in InfluxDB OSS 2.9.0 — tokens are hashed on disk by default. Existing tokens are hashed on first startup and can’t be recovered afterward. Capture any plaintext tokens you still need before you upgrade.

View InfluxDB OSS 2.9.0 release notes

Hashed tokens authenticate exactly like unhashed tokens — clients and integrations keep working.

Also new in 2.9.0:

  • Configurable backup compression
  • Restore support for backups containing hashed tokens
  • Tighter Edge Data Replication queue validation
  • Flux upgrade
  • Compaction reliability improvements

Key enhancements in Explorer 1.9

Explorer 1.9 is now available with InfluxQL support, an AI-assisted Flux to SQL converter (beta), and new live sample data simulators.

View Explorer 1.9 release notes

Explorer 1.9 includes new features and improvements that make it easier to query, visualize, and manage data.

Highlights:

  • Flux to SQL converter (beta): Convert Flux queries to SQL with an AI-assisted converter.
  • InfluxQL support: Query data with InfluxQL in the Data Explorer and dashboards, and save and load InfluxQL queries.
  • InfluxQL visualizations: Render line and bar charts from InfluxQL results with per-tag series grouping.
  • Query error history: Review a history of query errors in the query tool.
  • Live sample data simulators: Generate continuous live sample data with new bird data and signal generator simulators.

For more details, see Explorer 1.9 release notes

InfluxDB 3.10 is now available

InfluxDB 3 Core 3.10 adds an automatic catalog format upgrade, a configurable query-concurrency limit, and processing engine improvements.

Key updates in InfluxDB 3 Core 3.10:

  • Catalog format upgrade: the on-disk catalog automatically upgrades from format v2 to v3 on first 3.10 startup. Migration is one-way—back up your catalog before upgrading.
  • --max-concurrent-queries: limit concurrent queries (adjustable at runtime).
  • GET /ready endpoint for readiness probes.
  • Processing engine: cross-database queries and trigger lockdown flags.

For more information, see the InfluxDB 3 Core release notes.

InfluxDB 3.10 is now available

InfluxDB 3 Enterprise 3.10 adds automated backup and restore, row-level deletions, and user management, with an automatic catalog format upgrade and performance preview improvements.

Key updates in InfluxDB 3 Enterprise 3.10:

  • Catalog format upgrade: the on-disk catalog automatically upgrades from format v2 to v3 on first 3.10 startup. Migration is one-way—back up your catalog before upgrading.
  • Automated backup and restore (beta)
  • Row-level deletions
  • User management (authentication and RBAC) — preview
  • Performance preview improvements

Backup and restore, row-level deletions, and the performance preview require the Enterprise storage engine upgrade (opt-in beta). Beta and preview features are subject to breaking changes and aren’t recommended for production use.

For more information, see the InfluxDB 3 Enterprise release notes

Telegraf Enterprise is now generally available

Telegraf Enterprise is now generally available, along with Telegraf Controller v1.0.

Telegraf Enterprise combines Telegraf Controller, a centralized management console for Telegraf, with official support from InfluxData. Manage configurations, monitor fleet health, and operate tens of thousands of Telegraf agents from a single system.

InfluxDB Docker latest tag changing to InfluxDB 3 Core

On September 15, 2026, the latest tag for InfluxDB Docker images will point to InfluxDB 3 Core. To avoid unexpected upgrades, use specific version tags in your Docker deployments.

If using Docker to install and run InfluxDB, the latest tag will point to InfluxDB 3 Core. To avoid unexpected upgrades, use specific version tags in your Docker deployments. For example, if using Docker to run InfluxDB v2, replace the latest version tag with a specific version tag in your Docker pull command–for example:

docker pull influxdb:2