I have written a script to check free disk space on my hosts and have set it to get an hours worth of data every 10 minutes in a window. The problem is the window appears to be ignoring these time frames and alerts me every minute. I’ve been getting alerts every minute since 11am.
var db = 'telegraf' var rp = 'autogen' var measurement = 'win_disk' var name = 'Stream Free Disk Space2' var groupBy = ['host'] var whereFilter = lambda: TRUE //("Percent_Free_Space" < crit) var outputDB = 'chronograf' var outputRP = 'autogen' var outputMeasurement = 'alerts' //var period = 60m //var every = 10m var crit = 95 var diskSpace = stream |from() .database(db) .measurement(measurement) .groupBy(groupBy) |window() .period(60m) .every(10m) .align() |mean('Percent_Free_Space') .as('Free_Space_Mean') |eval(lambda: "Free_Space_Mean") .as('value') var trigger = diskSpace |alert() .all() .crit(lambda: "value" < crit) .message('A Message') .email('email@example.com') .stateChangesOnly(10m) .noRecoveries()
I’ve tried adding the times in using a variable but that throws me a ‘name not in scope’ error even though it is defined up top (i’ve commented them out since) and i’ve also tried adding them directly in to the .period and .every.
Nothing seems to work though, have i missed something?
Can any one point me in the right direction?