TICKscript doesn't seems to be running correctly

Hi,
I’m trying to build a quite simple script, however it doesn’t seems to be running, I’m receiving the following error in the watch logs for the task:
lvl=error msg=“failed to realize reduce context from fields” service=kapacitor task_master=main task=testing node=influxdb_out8 err=“field “free_storage_space_minimum” missing from point”

The script looks like that:

dbrp "telegraf"."autogen"

var db = 'telegraf'

var rp = 'autogen'

var measurement = 'cloudwatch_aws_es'

var groupBy = []

var whereFilter = lambda: ("domain_name" == 'backend01-dev')

var period = 1m

var every = 30s

var name = 'testing'

var idVar = name

var message = 'DEV {{.Level}}: {{.ID}} {{ index .Fields "value" }}'

var idTag = 'alertID'

var levelTag = 'level'

var messageField = 'message'

var durationField = 'duration'

var outputDB = 'chronograf'

var outputRP = 'autogen'

var outputMeasurement = 'alerts'

var triggerType = 'threshold'

var details = 'Please take action ASAP'

var crit = 10.0

var warn = 20.0

// var info = 30.0
var info = 50.0

var data = stream
    |from()
        .database(db)
        .retentionPolicy(rp)
        .measurement(measurement)
        .groupBy(groupBy)
        .where(whereFilter)
    |window()
        .period(period)
        .every(every)
        .align()
    |min('free_storage_space_minimum')
        .as('free_value')
    |min('total_volume_size')
        .as('disk_value')

// var percentage = eval(lambda: float("free_value")/float("disk_value") * 100.0)

var trigger = data
    |eval(lambda: "free_value"/"disk_value" * 100)
        .as('percentage')
    |alert()
        .info(lambda: float('percentage') < info)
        .warn(lambda: float('percentage') < warn)
        .crit(lambda: float('percentage') < crit)
        .message(message)
        .id(idVar)
        .idTag(idTag)
        .levelTag(levelTag)
        .messageField(messageField)
        .durationField(durationField)
        .details(details)
        .stateChangesOnly()
        .opsGenie2()

trigger
    |eval(lambda: float('percentage'))
        .as('value')
        .keep()
    |influxDBOut()
        .create()
        .database(outputDB)
        .retentionPolicy(outputRP)
        .measurement(outputMeasurement)
        .tag('alertName', name)
        .tag('triggerType', triggerType)

trigger
    |httpOut('output')

Can anyone help me to understand where the problem is? It seems like it missing starting point, however there is a period and every defined.

Also, is there a way to actually output your “values” to the watch script? It will be very helpful in future debugging.

I would hazard a guess that the field free_storage_space_minimum is missing from point, based on the error message you quote. Are you sure that your points have that as a field?

I not sure what you mean by “values” and “watch script” but perhaps you could have a look at the log() node: LogNode | Kapacitor 1.5 Documentation

By the way, note that you can use the “preformatted text” button in the editor (looks like </> ) on this website to help format your script text. Makes it a lot easier for people to read.