Invalid field type: <nil>

Hello.

I’m trying to use https://github.com/influxdata/kapacitor/blob/master/examples/telegraf/disk/disk_alert_stream.tick script to get alerting for disk space. But got following error on first evaluation:

[edge:disk_free_alert_stream|mean3->alert4] 2017/03/22 18:48:31 D! closing c: 0 e: 0
[edge:disk_free_alert_stream|window2->mean3] 2017/03/22 18:48:31 I! aborting c: 1 e: 1
[disk_free_alert_stream:mean3] 2017/03/22 18:48:31 E! invalid influxql func mean with field used_percent: invalid field type: <nil>
[task_store] 2017/03/22 18:48:31 D! task disk_free_alert_stream finished
[edge:disk_free_alert_stream|stream->stream0] 2017/03/22 18:48:31 D! closing c: 22 e: 22
[edge:disk_free_alert_stream|stream0->from1] 2017/03/22 18:48:31 D! closing c: 22 e: 22
[edge:disk_free_alert_stream|from1->window2] 2017/03/22 18:48:31 D! closing c: 22 e: 22
[edge:disk_free_alert_stream|window2->mean3] 2017/03/22 18:48:31 D! closing c: 1 e: 1
[task_master:main] 2017/03/22 18:48:31 E! Stopped task: disk_free_alert_stream mean3: invalid influxql func mean with field used_percent: invalid field type: <nil>
[task_store] 2017/03/22 18:48:31 E! task disk_free_alert_stream finished with error: mean3: invalid influxql func mean with field used_percent: invalid field type: <nil>

On the other side batch script working (https://github.com/influxdata/kapacitor/blob/master/examples/telegraf/disk/disk_alert_batch.tick). But is seems you have to specity each partition there manually, so it’s not very convenient.

Do you have any ideas why this error occurs? Thank you.

@danisabad can you post the results of kapacitor show disk_free_alert_stream? Is there data coming into the task?

Yes, sure.

# kapacitor show disk_free_alert_stream
ID: disk_free_alert_stream
Error: mean3: invalid influxql func mean with field used_percent: invalid field type: <nil>
Template: 
Type: stream
Status: enabled
Executing: false
Created: 22 Mar 17 18:43 EET
Modified: 22 Mar 17 18:48 EET
LastEnabled: 22 Mar 17 18:48 EET
Databases Retention Policies: ["telegraf"."autogen"]
TICKscript:
// disk_alert_stream

// metric: used_percent
// available_fields: free","inodes_free","inodes_total","inodes_used","total","used"

// TELEGRAF CONFIGURATION
// [[inputs.disk]]
//   ignore_fs = ["tmpfs", "devtmpfs"]

// DEFINE: kapacitor define disk_alert_stream -type stream -tick disk/disk_alert_stream.tick -dbrp telegraf.autogen
// ENABLE: kapacitor enable disk_alert_stream

// Parameters
var info = 75

var warn = 85

var crit = 92

var period = 10s

var every = 10s

// Dataframe
var data = stream
    |from()
        .database('telegraf')
        .retentionPolicy('autogen')
        .measurement('disk')
        .groupBy('host')
    |window()
        .period(period)
        .every(every)
    |mean('used_percent')
        .as('stat')

// Thresholds
var alert = data
    |alert()
        .id('{{ index .Tags "host"}}/disk_used')
        .message('{{ .ID }}:{{ index .Fields "stat" }}')
        .info(lambda: "stat" > info)
        .warn(lambda: "stat" > warn)
        .crit(lambda: "stat" > crit)

// Alert
alert
        .log('/tmp/disk_alert_log.txt')

DOT:
digraph disk_free_alert_stream {
stream0 -> from1;
from1 -> window2;
window2 -> mean3;
mean3 -> alert4;
}

And as I understood from ‘Getting Started’ guide this means that there was no data points processes, right?
But than i do recording, I get data:

# kapacitor record stream -task disk_free_alert_stream -duration 1m
78603131-d450-4745-8209-f3d69144d966
# kapacitor list recordings | grep 78603131-d450-4745-8209-f3d69144d966
78603131-d450-4745-8209-f3d69144d966 stream  finished  1.6 kB    23 Mar 17 11:46 EET    

And while replaying have same error:

# kapacitor replay -recording 78603131-d450-4745-8209-f3d69144d966 -task disk_free_alert_stream
458853df-0d81-4247-ab44-1e9f814b8c0f
task run: mean3: invalid influxql func mean with field used_percent: invalid field type: <nil>

What would you recommend as next step to debug?