Hello All,
I am working on a tick script to send alerts if no data is received from a measurement for more than 2 minutes. The main purpose of this script is to send alerts if a host is down for more than 2 minutes.
I use the below script
I followed the article in the below link,
https://maxchadwick.xyz/blog/send-a-kapacitor-alert-if-no-data-is-received
dbrp "telegraf"."autogen" var data = stream |from() .database('telegraf') .retentionPolicy('autogen') .measurement('mem') .groupBy('host') data |deadman(0.0, 2m) .stateChangesOnly() .message('{{index .Tags "host"}} may be {{if eq .Level "CRITICAL"}}Down{{else}}UP{{end}} or Telegraf agent running on this machine may be down') .opsGenie()
I have successfully implemented this alerting and alerts are being generated if no data is received from mem metric for more than 1 minute.
The question I want to ask here today is related to the query part.
I want to understand if the query I wrote in the script is quering all the mem data in my database.
or just alerting last few minutes of this measurement.
If It is alerting all the data from the mem measurement then,
I want to use the below functions here because when I implement this tick script on a larger database unlike my current database in my dev I want it to work foolproof.
.period(5m)
.every(2m)
But when i use these functions I am getting
no method or property “period” on *pipeline.FromNode
the above error
Using kapacitor version:Kapacitor OSS 1.4.1
Can you please suggest me what I can do to successfully implement this