This simple tick script doesn’t send alerts.
var db = ‘telegraf’
var rp = ‘autogen’
var measurement = ‘interface’
var groupBy =
var whereFilter = lambda: (“ifDescr” == ‘FastEthernet0/1’)
var period = 10s
var every = 30s
var name = ‘testif’
var idVar = name
var message = ‘’
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 crit = 1589484996
var data = stream
|from()
.database(db)
.retentionPolicy(rp)
.measurement(measurement)
.groupBy(groupBy)
.where(whereFilter)
|window()
.period(period)
.every(every)
.align()
|mean(‘ifOutOctets’)
.as(‘value’)
var trigger = data
|alert()
.crit(lambda: “value” > crit)
.message(message)
.id(idVar)
.idTag(idTag)
.levelTag(levelTag)
.messageField(messageField)
.durationField(durationField)
.email()
.to(‘myemail@domain.com’)
trigger
|eval(lambda: float(“value”))
.as(‘value’)
.keep()
|influxDBOut()
.create()
.database(outputDB)
.retentionPolicy(outputRP)
.measurement(outputMeasurement)
.tag(‘alertName’, name)
.tag(‘triggerType’, triggerType)
trigger
|httpOut(‘output’)
and here is the output:
DOT:
digraph chronograf-v1-a4e92193-9778-40b5-a025-dad88819160d {
graph [throughput="0.00 points/s"];
stream0 [avg_exec_time_ns="0s" errors="0" working_cardinality="0" ];
stream0 -> from1 [processed="1782"];
from1 [avg_exec_time_ns="3.427µs" errors="0" working_cardinality="0" ];
from1 -> window2 [processed="11"];
window2 [avg_exec_time_ns="0s" errors="0" working_cardinality="1" ];
window2 -> mean3 [processed="10"];
mean3 [avg_exec_time_ns="0s" errors="0" working_cardinality="1" ];
mean3 -> alert4 [processed="0"];
alert4 [alerts_inhibited="0" alerts_triggered="0" avg_exec_time_ns="0s" crits_triggered="0" errors="0" infos_triggered="0" oks_triggered="0" warns_triggered="0" working_cardinality="0" ];
alert4 -> http_out7 [processed="0"];
alert4 -> eval5 [processed="0"];
http_out7 [avg_exec_time_ns="0s" errors="0" working_cardinality="0" ];
eval5 [avg_exec_time_ns="0s" errors="0" working_cardinality="0" ];
eval5 -> influxdb_out6 [processed="0"];
influxdb_out6 [avg_exec_time_ns="0s" errors="0" points_written="0" working_cardinality="0" write_errors="0" ];
}
notice these lines:
mean3 [avg_exec_time_ns=“0s” errors=“0” working_cardinality=“1” ];
mean3 -> alert4 [processed=“0”];
Any help would be greatly appreciated.