Kapacitor condition to do not spam alerts


I have a very basic metric “if CPU > 75% than send alert to email”. But problem that I receive a lot of spam in case if this load happens during 10-15 minutes.

How to prevent it and send second message for example only after 5 minutes in case if this load still exist?

Thank you.

1 Like

Post your tickscript!

1 Like

Hello! I was wondering the same thing! Here’s my TickScript.
var db = ‘windows’

var rp = ‘server_rp’

var measurement = ‘win_cpu’

var groupBy =

var whereFilter = lambda: (“host” == ‘HOSTNAME’)

var name = ‘Windows Testing’

var idVar = name

var message = ‘{{.Tags}}’

var idTag = ‘alertID’

var levelTag = ‘level’

var messageField = ‘message’

var durationField = ‘duration’

var outputDB = ‘chronograf’

var outputRP = ‘autogen’

var outputMeasurement = ‘alerts’

var triggerType = ‘threshold’

var details = ‘CPU over 50% on {{.Tags}}’

var crit = 75

var data = stream
|eval(lambda: “Percent_Privileged_Time”)

var trigger = data
.crit(lambda: “value” > crit)

|eval(lambda: float(“value”))
.tag(‘alertName’, name)
.tag(‘triggerType’, triggerType)



Add .stateChangesOnly() to your alert node docs

Unless it’s in the wrong place, I do have that in there no?

Ah yeah, i missed it. I normally hae it further up in the node. My bad. One thing i did notice, you’re using hostname in your whereFilter. your groupBy() looks empty. Try adding the hostname tag to your group by