Created
November 4, 2016 18:58
-
-
Save thomastaylor312/c5f5330fabe22d0c54ed445b6eef8639 to your computer and use it in GitHub Desktop.
An example Kapacitor alert
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
stream | |
// The following stream alerts based on changes in cpu/usage | |
// Every minute the rate of change for the cpu/usage is calculated | |
// Alerts are sent out when that rate is unusually high | |
|from() | |
.measurement('cpu/usage') | |
.where(lambda: "type" == 'node' AND "nodename" =~/.*cassandra.*/) | |
.groupBy('nodename') | |
|derivative('value') | |
.unit(60s) | |
.nonNegative() | |
|window() | |
.period(1m) | |
.every(1m) | |
|alert() | |
.id('{{ .Name }}/{{ index .Tags "nodename" }}') | |
.message('{{ .ID }} is increasing at a {{ .Level }} rate. value:{{ index .Fields "value" }}') | |
// Sigma is a built in Kapacitor function used to calculate standard deviations | |
// 2 standard deviations away is about 95% greater than normal | |
.warn(lambda: sigma("value")> 2) | |
.crit(lambda: sigma("value")> 2.5) | |
.slack() | |
.channel('#alerts') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment