Invalid Tick script

Hi,

I have this TICK script but i couldn’t find the error. I have added some [[httppost]] to the kapacitor.config for endpoint “onoff”

batch
    |query('SELECT mean(usage_idle) as usage_idle FROM "telegraf"."autogen".cpu')
        .period(5m)
        .every(1m)
    |influxDBOut()
        .database('telegraf')
        .retentionPolicy('autogen')
        .measurement('cpu_idle_1hour')
        .precision('s')
	|alert()
    	.info(lambda: "usage_idle" > 80)
        .warn(lambda: "usage_idle" > 90)
        .crit(lambda: "usage_idle" > 95)
        .post()
        	.endpoint('onoff')

You can use “kapacitor show < task name >” to see the output from the task itself. I tend to do that, then tail my kapacitor logs for the taskname so i can see when it runs.

Have you tried swapping the |influxDBOut and |Alert nodes around?

|alert()
    	.info(lambda: "usage_idle" > 80)
        .warn(lambda: "usage_idle" > 90)
        .crit(lambda: "usage_idle" > 95)
        .post()
        	.endpoint('onoff')

|influxDBOut()
        .database('telegraf')
        .retentionPolicy('autogen')
        .measurement('cpu_idle_1hour')
        .precision('s')

Also, i think you have a typo. Should you be specifying .httpPost(), instead of .post()?

|alert()
    	.info(lambda: "usage_idle" > 80)
        .warn(lambda: "usage_idle" > 90)
        .crit(lambda: "usage_idle" > 95)
        .httpPost()
        	.endpoint('onoff')
1 Like

Thanks @philb ,

I was trying different permutations and combinations yesterday and it worked when i moved the alert above the influxDBOut. But Unfortunately, i couldn’t figure out the reason behind and hence kept the question opened.

Thanks for sharing tips for debugging.