Tickscript help

I’m trying to emulate a dashboard script with thickscript
bascaly im tring to count how many vacnt points i have in 10 sec
in the dashbord

SELECT count(“status”) AS “count_status” FROM “telegraf”.“autogen”.“parking” WHERE time > now() - 10s AND “status”=‘vacant’ GROUP BY time(10s)

I’m trying to do the same as task and output it to nats measurement

stream
|from()
.database(‘telegraf.autogen’)
.measurement(‘parking’)
.where(lambda: “status” == ‘vacant’)
|window()
.period(10s)
.every(10s)
|influxDBOut()
.database(‘telegraf.autogen’)
.measurement(‘natsout’)

  1. I’m assuming that I’m doing something wrong in the script but cant figure what ?
  2. Is their a way to push the data out to nats without saving it again in influx ?
stream
|from()
  .database('telegraf.autogen')
  .measurement('parking')
  .where(lambda: "status" == 'vacant')
|window()
  .period(10s)
  .every(10s)
// Add the count step
|count('status')
|influxDBOut()
  .database('telegraf.autogen')
  .measurement('natsout')

There is no NATs output currently but would be a good feature to add, Can you create an issue on Github requesting NATS output? Thanks

1 Like

@nathaniel i opened an issue.
can you address me to some similar code I will try to write it myself.
thanks

@miki_haiat THanks, have a look at the influxDBOut and httpPost nodes as those both output data to external systems.

See kapacitor/influxdb_out.go at master · influxdata/kapacitor · GitHub and kapacitor/http_post.go at master · influxdata/kapacitor · GitHub

The basic design will be to create a nats service in kapacitor/services at master · influxdata/kapacitor · GitHub and then consume the service in a nats_out.go node code.

1 Like

the script working but without the autogen suffix
I don’t know if it`s should be an issue or not ?

Yes you are right, this .database('telegraf.autogen') should be .database('telegraf').