Unable to access 'used' variable in sample: cpu_alert_stream.tick

Hello all,

I am new here and exploring the TICK stack for performance monitoring of my systems. I have InfluxDB and telegraf installed and working fine. Next step is to get kapacitor to generate alert based on telegraf data. I have gone through the TICKScript docs and I kind of understand it.

As a start I am toying with the cpu_alert_stream.tick from examples. Installed it and enabled it. In the script I can see that

 |eval(lambda: 100.0 - "usage_idle")
   .as('used')

used is defined as the result of the lambda expression 100.0 - "usage_idle". I am trying to use this in my .slack() alert as

  |alert()
    .stateChangesOnly()
    .id('{{ index .Tags "host"}}/cpu_used')
    .message('{{ .ID }}:{{ index .Fields "used" }}')
    .info(lambda: "stat" > info)
    .warn(lambda: "stat" > warn)
    .crit(lambda: "stat" > crit)

// Alert
alert
  .log('/tmp/cpu_alert_log.txt')
  .slack()

But slack alert shows myhost/cpu_used:<no value> as the alert text.

I checked the log file and there I can see that columns field does not have used entry.

{
	"id": "myhost/cpu_used",
	"message": "myhost/cpu_used:\u003cno value\u003e",
	"details": "<snip>"
	"time": "2018-01-08T14:29:00Z",
	"duration": 600000000000,
	"level": "OK",
	"data": {
		"series": [{
			"name": "cpu",
			"tags": {
				"host": "myhost"
			},
			"columns": ["time", "sigma", "stat"],
			"values": [
				["2018-01-08T14:29:00Z", 1.3058797541228238, 6.069626391496513]
			]
		}]
	}
}

It would be great if some one can help me figure out why I am unable to use used

Thanks!

Bump! Any one to help me with this??