We have a central InfluxDB server which receives measurements from numerous hosts in our network. We want to export measurements from specific hosts to a customer database and tag that with a customer ID. For this I tried to write a number of TICK scripts to fix this in Kapacitor. However, I can’t get the script to work: although the script loads, no data is written to the target database.
This is one of many attempts to get this to work:
dbrp "telegraf"."autogen"
stream
|from()
.database('telegraf')
.retentionPolicy('autogen')
.measurement('jitsi_stats')
.where(lambda: ("host" =~ '/customer-hostname/'))
.groupBy(*)
|influxDBOut()
.cluster('writer')
.database('customer')
.retentionPolicy('retention_30d')
.measurement('jitsi_stats')
.tag('customer_id', '12345')
If I try to query the Influx database, I get proper data:
> select bit_rate_download from "telegraf"."autogen".jitsi_stats where host =~ /customer-hostname/ and time > now() - 1m
name: jitsi_stats
time bit_rate_download
---- -----------------
2020-07-13T09:45:39Z 0
2020-07-13T09:45:40Z 0
(etc)
Any hints on what I’m doing wrong and how to get this to work would be appreciated!