Hi, I’m following this guide (Template tasks | Kapacitor 1.5 Documentation) and instead of trying to send emails out I want to just calculate the mean for the past 5 min and log the output on a 1 min interval. I’m not sure how to pass the log() parameters in the JSON vars file.
This is my template:
# cat log_batch_template.tick
// Which measurement to consume
var measurement string
// Which database/rp/measurement to use
var db string
// Optional where filter
var where_filter = lambda: TRUE
// Optional list of group by dimensions
var groups = [*]
// Which field to process
var field string
// How much data to window
var window = 5m
// What interval to show data
var interval = 1m
batch
|query('''
SELECT mean(measurement) AS inMeanOctets
FROM db
WHERE where_filter
''')
.period(window)
.every(interval)
|mean(field)
|log()
This is my vars.json file:
{
"measurement": {"type" : "string", "value" : "interfaces" },
"where_filter": {"type": "lambda", "value": "\"device\" == 'HUBC01'"},
"groups": {"type": "list", "value": [{"type":"string", "value":"device"}]},
"field": {"type" : "string", "value" : "inOctets" },
"warn": {"type" : "lambda", "value" : "\"mean\" < 30.0" },
"crit": {"type" : "lambda", "value" : "\"mean\" < 10.0" },
"window": {"type" : "duration", "value" : "5m" },
"log": {?????}
}
What do I put in the “log” object from the JSON file that will log the 5 minute mean of inOctets every min?
Thank you.