Different event handlers can be configured for each AlertNode.
Some handlers like Email, HipChat, Sensu, Slack, OpsGenie, VictorOps, PagerDuty, Telegram and Talk have a configuration
option 'global' that indicates that all alerts implicitly use the handler.

Available event handlers:

log – log alert data to file.

post – HTTP POST data to a specified URL.

email – Send and email with alert data.

exec – Execute a command passing alert data over STDIN.

HipChat – Post alert message to HipChat room.

Alerta – Post alert message to Alerta.

Sensu – Post alert message to Sensu client.

Slack – Post alert message to Slack channel.

OpsGenie – Send alert to OpsGenie.

VictorOps – Send alert to VictorOps.

PagerDuty – Send alert to PagerDuty.

Talk – Post alert message to Talk client.

Telegram – Post alert message to Telegram client.

See below for more details on configuring each handler.

Each event that gets sent to a handler contains the following alert data:

ID – the ID of the alert, user defined.

Message – the alert message, user defined.

Details – the alert details, user defined HTML content.

Time – the time the alert occurred.

Duration – the duration of the alert in nanoseconds.

Level – one of OK, INFO, WARNING or CRITICAL.

Data – influxql.Result containing the data that triggered the alert.

Events are sent to handlers if the alert is in a state other than 'OK'
or the alert just changed to the 'OK' state from a non 'OK' state (a.k.a. the alert recovered).
Using the AlertNode.StateChangesOnly property events will only be sent to handlers
if the alert changed state.

It is valid to configure multiple alert handlers, even with the same type.

Each expression maintains its own state.
The order of execution for the expressions is not considered to be deterministic.
For each point an expression may or may not be evaluated.
If no expression is true then the alert is considered to be in the OK state.

Kapacitor supports alert reset expressions.
This way when an alert enters a state, it can only be lowered in severity if its reset expression evaluates to true.

CritReset

Details

Template for constructing a detailed HTML message for the alert.
The same template data is available as the AlertNode.Message property,
in addition to a Message field that contains the rendered Message value.

The intent is that the Message property be a single line summary while the
Details property is a more detailed message possibly spanning multiple lines,
and containing HTML formatting.

This template is rendered using the html/template package in Go so that
safe and valid HTML can be generated.

The json method is available within the template to convert any variable to a valid
JSON string.

DurationField

Optional field key to add the alert duration to the data.
The duration is always in units of nanoseconds.

node.durationField(value string)

Email

Email the alert data.

If the To list is empty, the To addresses from the configuration are used.
The email subject is the AlertNode.Message property.
The email body is the AlertNode.Details property.
The emails are sent as HTML emails and so the body can contain html markup.

If the 'smtp' section in the configuration has the option: global = true
then all alerts are sent via email without the need to explicitly state it
in the TICKscript.

Flapping

Each different alerting level is considered a different state.
The low and high thresholds are inverted thresholds of a percentage of state changes.
Meaning that if the percentage of state changes goes above the high
threshold, the alert enters a flapping state. The alert remains in the flapping state
until the percentage of state changes goes below the low threshold.
Typical values are low: 0.25 and high: 0.5. The percentage values represent the number state changes
over the total possible number of state changes. A percentage change of 0.5 means that the alert changed
state in half of the recorded history, and remained the same in the other half of the history.

node.flapping(low float64, high float64)

HipChat

If the 'hipchat' section in the configuration has the option: global = true
then all alerts are sent to HipChat without the need to explicitly state it
in the TICKscript.

NoRecoveries

Do not send recovery alerts.

node.noRecoveries()

OpsGenie

Send alert to OpsGenie.
To use OpsGenie alerting you must first enable the 'Alert Ingestion API'
in the 'Integrations' section of OpsGenie.
Then place the API key from the URL into the 'opsgenie' section of the Kapacitor configuration.

If the "value" is greater than 10 for a total of 60s, then
only two events will be sent. First, when the value crosses
the threshold, and second, when it falls back into an OK state.
Without stateChangesOnly, the alert would have triggered 7 times:
6 times for each 10s period where the condition was met and once more
for the recovery.

An optional maximum interval duration can be provided.
An event will not be ignore (aka trigger an alert) if more than the maximum interval has elapsed
since the last alert.

Telegram ChatId

Telegram user/group ID to post messages to.
If empty uses the chati-d from the configuration.

node.telegram()
.chatId(value string)

Telegram DisableNotification

Disables the Notification. If empty defaults to the configuration.

node.telegram()
.disableNotification()

Telegram DisableWebPagePreview

Disables the WebPagePreview. If empty defaults to the configuration.

node.telegram()
.disableWebPagePreview()

Telegram ParseMode

Parse node, defaults to Mardown
If empty uses the parse-mode from the configuration.

node.telegram()
.parseMode(value string)

VictorOps

Send alert to VictorOps.
To use VictorOps alerting you must first enable the 'Alert Ingestion API'
in the 'Integrations' section of VictorOps.
Then place the API key from the URL into the 'victorops' section of the Kapacitor configuration.

Example:

[victorops]
enabled = true
api-key = "xxxxx"
routing-key = "everyone"

With the correct configuration you can now use VictorOps in TICKscripts.

Example:

stream
|alert()
.victorOps()

Send alerts to VictorOps using the routing key in the configuration file.

Example:

stream
|alert()
.victorOps()
.routingKey('team_rocket')

Send alerts to VictorOps with routing key 'team_rocket'

If the 'victorops' section in the configuration has the option: global = true
then all alerts are sent to VictorOps without the need to explicitly state it
in the TICKscript.

Elapsed

Eval

Create an eval node that will evaluate the given transformation function to each data point.
A list of expressions may be provided and will be evaluated in the order they are given.
The results are available to later expressions.

HttpOut

Create an HTTP output node that caches the most recent data it has received.
The cached data are available at the given endpoint.
The endpoint is the relative path from the API endpoint of the running task.
For example, if the task endpoint is at /kapacitor/v1/tasks/&lt;task_id&gt; and endpoint is
top10, then the data can be requested from /kapacitor/v1/tasks/&lt;task_id&gt;/top10.

Spread

Stats

Create a new stream of data that contains the internal statistics of the node.
The interval represents how often to emit the statistics based on real time.
This means the interval time is independent of the times of the data points the source node is receiving.