I’m noob using Kapacitor and influxdb, but, I created 3 alerts (cpu,mem and disk) for differents hosts and they are working fine.
Now, I want to create and alert that notify me if a host/server is down or offline.
I read about deadman and created and alert, but, I think it doesn’t work:
|from()
.database('telegraf')
.retentionPolicy('autogen')
.measurement('system')
|deadman(1.0, 10s)
.message('Server {{ index .Tags "node" }} DOWN!')
.hipChat()
.stateChangesOnly()````
I think that something is wrong, but I can't find ane example for my case.
Any ideas?
I can have something similar for Host - UP/ DOWN using telegraf + InlfuxDB + Grafana an not having Kapacitor?
I could do something with Grafana “Alert”?
Hey @michael
I am using kapacitor v1.5 and I want alerting to be set on a metric whenever the “Active” changes.
This is the code I am using.
var info = 1
var warn = 2
var crit = 3
var period = 15s
var every = 15s
// Dataframe
var data = batch
|query('SELECT ActiveBaselineNodes AS Active FROM “telegraf_ignite_sit”.“autogen”.“kernel_cluster_metrics” ')
.groupBy(‘host’)
.period(period)
.every(every)
// Thresholds
var alert = data
|alert()
.id(’{{ index .Tags “host”}}/baselinenodes’)
.message(’{{ .ID }}:{{ index .Fields “Active” }}’)
// .info(lambda: “Active” > info)
// .warn(lambda: “Active” > warn)
// .crit(lambda: “Active” > crit)
.stateChangesOnly()
.slack()
.log(’/data/kapacitor_alerts/ignite/activebaseline.txt’)
How should I use stateChangesOnly()? I don’t want to statically define the comparing parameters.
Good day, can you explain, please, how to do alert like nagios:
Check host every 10 second, if host is down, send message: “Host is down”,
continue check host every 10 second, and send repeated messages “Host is down” ONLY ONCE in 1-2 hours, or even just ONCE. When host will up, send message “Host is up”. Thanks in advance.
When I tried to do this, messages come every 10 seconds, even if .stateChangesOnly() is stated.