w***@gmail.com
2017-11-14 16:16:28 UTC
Hi,
I am creating a script that enables an alert to be send based on predicted disk utilisation in hours, The problem I am having is that I cannot used the vars disk_reamaining.value and rate. Any help would be appreciated.
var historical = batch
|query('select "used" from "telegraf"."autogen".disk limit 1')
.period(1m)
.every(1m)
.offset(5m)
.align()
.groupBy(*)
var current = batch
|query('select "used" from "telegraf"."autogen".disk limit 1')
.period(1m)
.every(1m)
.align()
.groupBy(*)
var disk_remaining = batch
|query('select "free" from "telegraf"."autogen".disk limit 1')
.period(1m)
.every(1m)
.align()
.groupBy(*)
historical
|shift(5m)
|join(current)
.as('historical', 'current')
|eval(lambda: "current.value" - "historical.value")
.as('rate')
disk_remaining
|eval(lambda: "disk_remaining.value" / "rate")
.as('fill_rate')
|eval(lambda: "fill_rate" * 5)
.as('time_to_full')
|eval(lambda: "time_to_full" / 60)
.as('time_in_hrs')
|alert()
.id('/{{ .Name }}/{{ index .Tags "sn" }}')
.details('nothing')
.info(lambda: "time_in_hrs" > 20)
.warn(lambda: "time_in_hrs" > 5)
.crit(lambda: "time_in_hrs" > 1)
.log('/tmp/disk_alert_batch.txt')
I am creating a script that enables an alert to be send based on predicted disk utilisation in hours, The problem I am having is that I cannot used the vars disk_reamaining.value and rate. Any help would be appreciated.
var historical = batch
|query('select "used" from "telegraf"."autogen".disk limit 1')
.period(1m)
.every(1m)
.offset(5m)
.align()
.groupBy(*)
var current = batch
|query('select "used" from "telegraf"."autogen".disk limit 1')
.period(1m)
.every(1m)
.align()
.groupBy(*)
var disk_remaining = batch
|query('select "free" from "telegraf"."autogen".disk limit 1')
.period(1m)
.every(1m)
.align()
.groupBy(*)
historical
|shift(5m)
|join(current)
.as('historical', 'current')
|eval(lambda: "current.value" - "historical.value")
.as('rate')
disk_remaining
|eval(lambda: "disk_remaining.value" / "rate")
.as('fill_rate')
|eval(lambda: "fill_rate" * 5)
.as('time_to_full')
|eval(lambda: "time_to_full" / 60)
.as('time_in_hrs')
|alert()
.id('/{{ .Name }}/{{ index .Tags "sn" }}')
.details('nothing')
.info(lambda: "time_in_hrs" > 20)
.warn(lambda: "time_in_hrs" > 5)
.crit(lambda: "time_in_hrs" > 1)
.log('/tmp/disk_alert_batch.txt')
--
Remember to include the version number!
---
You received this message because you are subscribed to the Google Groups "InfluxData" group.
To unsubscribe from this group and stop receiving emails from it, send an email to influxdb+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
Visit this group at https://groups.google.com/group/influxdb.
To view this discussion on the web visit https://groups.google.com/d/msgid/influxdb/c9773a2e-c379-43ef-adef-506095ae9a5a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Remember to include the version number!
---
You received this message because you are subscribed to the Google Groups "InfluxData" group.
To unsubscribe from this group and stop receiving emails from it, send an email to influxdb+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
Visit this group at https://groups.google.com/group/influxdb.
To view this discussion on the web visit https://groups.google.com/d/msgid/influxdb/c9773a2e-c379-43ef-adef-506095ae9a5a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.