# Invalid Tick script

**URL:** <https://community.influxdata.com/t/invalid-tick-script/8168>\
**Category:** Kapacitor\
**Tags:** kapacitor, chronograf\
**Created:** [January 17, 2019, 10:36am UTC](https://community.influxdata.com/t/invalid-tick-script/8168 "2019-01-17T10:36:44Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![BhanuKiran](https://avatars.discourse-cdn.com/v4/letter/b/ee59a6/32.png) [@BhanuKiran](https://community.influxdata.com/u/BhanuKiran)\
**Post date:** [January 17, 2019, 10:36am UTC](https://community.influxdata.com/t/invalid-tick-script/8168/1 "2019-01-17T10:36:44Z")

</div>

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')
```

---

<div class="post-metadata">

**Author:** ![philb](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/philb/32/1805_2.png) [@philb](https://community.influxdata.com/u/philb)\
**Post date:** [January 17, 2019, 2:54pm UTC](https://community.influxdata.com/t/invalid-tick-script/8168/2 "2019-01-17T14:54:02Z")

</div>

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?

```auto
|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()?

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

```

---

<div class="post-metadata">

**Author:** ![BhanuKiran](https://avatars.discourse-cdn.com/v4/letter/b/ee59a6/32.png) [@BhanuKiran](https://community.influxdata.com/u/BhanuKiran)\
**Post date:** [January 18, 2019, 8:45am UTC](https://community.influxdata.com/t/invalid-tick-script/8168/3 "2019-01-18T08:45:51Z")

</div>

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**.
