Hi, I’m trying to get Kapacitor to only log data to a log file when a certain condition is met and not send out an email.
I have SMTP enabled in my kapacitor.conf file:
[smtp]
enabled = true
host = “10.10.10.1”
port = 25
from = “team.email@email.com”
to = [“my_email@email.com”]
no-verify = true
idle-timeout = “30s”
global = true
state-changes-only = true
This is my batch script:
# cat alert_test_batch.tick
dbrp “database_name”.“autogen”
var data = batch
|query('''
SELECT last("inOctets") AS inOctets
FROM "database"."autogen".interfaces
WHERE "device" =~ /ELK/
''')
.period(5m)
.every(1m)
.groupBy(time(1m), 'interface-name')
|alert()
.crit(lambda: "inOctets" > 44179596)
.message('Data greater than threshold.')
.log('/var/lib/kapacitor/alert.log')
I was expecting to only have the data log to the alert.log file but I’m also getting emails sent.
Also, I wanted Kapacitor to check the previous five minutes every minute for the last “inOctets” value to see if its greater than the specified amount and then log which ever minute matched the criteria, however, it appears I get multiple log entries for the same minute.
Thank you,
Mohsin