Discussion:
[influxdb] kapacitor -- node|last() function
b***@rkrepsilon.com
2017-01-09 06:45:06 UTC
Permalink
Hi,

I have the following :
Kapacitor, v1.1.1
InfluxDB, v 1.1.1
Telegraf, v1.1.2


I am having a little bit of trouble with the |last() function. (Or maybe my
understanding of it)
My TICK script gets loaded into Kapacitor with out any error.
After some time the "kapacitor show tasks" command lists the task as
"Executing:false".
I guess this is when the task has its first match on the incoming data
stream.

I have this in my TICK script :
----------------
var window = 1m
var every = 1m

var data = stream
|from()
.measurement('system')
.groupBy('host')
|window()
.period(window)
.every(every)
|last('uptime')
.as('last_uptime')
----------------

"system" is my measurement in InfluxDB.
"host" is a tag value in InfluxDB.
"uptime" is a field("integer") in InflxuDB.

I use the following to mach :
----------------
var crit = lambda: "last_uptime" < 300
var critReset = lambda: "last_uptime" >= 300
----------------

If I remove the "|Last()" function than the TICK scrip stays enabled, but
gives the wrong outcome.
IE; I get alerts for all points when "uptime" is from 0 to 300.
I just want to match on the last value.

Thanks for your help
Brendan
--
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/1f8c74ac-fa94-4286-9720-5b230d320722%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
b***@rkrepsilon.com
2017-01-10 01:54:31 UTC
Permalink
Hi Ross,

Thanks for the reply.
I do see the error in the `kapacitor show`, I must of missed it the first
time! Here is the message :
"Error: last3: invalid influxql func last with field uptime: invalid field
type: <nil>"

I don't get why that is <nil> ?

The influxdb query "select last(uptime) from system" returns correctly.
If I run "SHOW FIELD KEYS on systems", I see that the "uptime" field is an
"integer"

Thanks
​If the task stops executing, there should be an error stating why it was
stopped next to the `Error:` heading in the `kapacitor show` output.
Can you share the output to the output of `kapacitor show` for your task?
Is there anything in the Kapacitor service logs for your task that look
like an error?
Post by b***@rkrepsilon.com
Hi,
Kapacitor, v1.1.1
InfluxDB, v 1.1.1
Telegraf, v1.1.2
I am having a little bit of trouble with the |last() function. (Or maybe
my understanding of it)
My TICK script gets loaded into Kapacitor with out any error.
After some time the "kapacitor show tasks" command lists the task as
"Executing:false".
I guess this is when the task has its first match on the incoming data
stream.
----------------
var window = 1m
var every = 1m
var data = stream
|from()
.measurement('system')
.groupBy('host')
|window()
.period(window)
.every(every)
|last('uptime')
.as('last_uptime')
----------------
"system" is my measurement in InfluxDB.
"host" is a tag value in InfluxDB.
"uptime" is a field("integer") in InflxuDB.
----------------
var crit = lambda: "last_uptime" < 300
var critReset = lambda: "last_uptime" >= 300
----------------
If I remove the "|Last()" function than the TICK scrip stays enabled, but
gives the wrong outcome.
IE; I get alerts for all points when "uptime" is from 0 to 300.
I just want to match on the last value.
Thanks for your help
Brendan
--
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
<javascript:>.
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/1f8c74ac-fa94-4286-9720-5b230d320722%40googlegroups.com
<https://groups.google.com/d/msgid/influxdb/1f8c74ac-fa94-4286-9720-5b230d320722%40googlegroups.com?utm_medium=email&utm_source=footer>
.
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/3b91965c-6941-4711-917d-13ea6878e22e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Loading...