Skip to content

Instantly share code, notes, and snippets.

Created February 28, 2017 17:54
What would you like to do?
Kapacitor alert to warn on inodes percent used
// inodes_alert example
// DEFINE: kapacitor define inodes_alert -type stream -tick inodes_alert.tick -dbrp telegraf.ninety_days
// ENABLE: kapacitor enable inodes_alert
// Parameters
var period = 5m
var every = 30s
var warn = 90
var crit = 95
var used = stream
.groupBy('host', 'path')
var total = stream
.groupBy('host', 'path')
var alert = used
|eval(lambda: float("used.max" / "total.max") * 100.00).as('inodes_used_percent')
// Thresholds
.id('{{ index .Tags "host"}}')
.message('{{ .Level }}: Volume {{ index .Tags "path"}} inodes used is {{ index .Fields "inodes_used_percent" }}% on HOST {{ .ID }}')
.warn(lambda: "inodes_used_percent" > warn)
.crit(lambda: "inodes_used_percent" > crit)
// .stateChangesOnly()
// Alert
// .room('ias_rampart_alerts')
.room('Kapacitor Testing')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment