Hello,
Kapacitor Version: OSS 1.5.0
Batch Tickscript takes the average.
It targets data points above 15% if true then trigger the alert and store data into influxdb.
Below tickscript neither triggers an alert nor stores data in influxdb.
What did i miss?
Also see attached snippet of the measurement, tickscript reading data from.
batch
|query(’’‘SELECT MEAN(Percent_Processor_Time) AS “Critical_Process_Avg_CPUTime” FROM “my_influxdb”.“two_hours”.“Process” WHERE instance != ‘_Total’ and instance != ‘Idle’ ‘’’)
.period(20s)
.every(10s)
|eval(lambda: “Critical_Process_Avg_CPUTime”)
.as(‘value’)
|groupBy(‘instance’)
|stateDuration(lambda: “value” >= 15)
.unit(1m)
|log()
|alert()
.details(’’)
.id(‘Above_Fifteen’)
.warn(lambda: “state_duration” >= 1)
.crit(lambda: “state_duration” >= 2)
.idField(‘id’)
.levelTag(‘level’)
.message(‘Attention Process CPU is High, High_Avg_Process_CPU_Time={{index .Fields “value”}}, Process ={{ index .Tags “instance” }}’)
.log(‘C:/temp/Kapacitor_Alerts/Critical_Process_CPUTime.log’)
|log()
|influxDBOut()
.database(‘my_influxdb’)
.retentionPolicy(‘a_year’)
.measurement(‘High_CPU_Consuming_Processes_3’)