Implementation of kapacitor to support multiple influxdb configurations in kapacitor.conf

Hello Everyone,

We have written a docker-compose file which spins up two influxdb instances running on ports 8086, 8087 and one kapaciotor instnace running on port 9092 locally. We are trying to implement multiple influxdb configurations in kapacitor.conf file, so that, kapacitor uses default influx instance for reading data and uses the second influxdb instance for writing the data.

We have added one more influxdb section, to kapacitor.conf file as below

[[influxdb]]
enabled = true
name = “default”
default = true
urls = [“http://influxread:8086”]

[[influxdb]]
enabled = true
name = “write”
default = false
disable-subscriptions = true
urls = [“http://influxdb-write:8087”]

and trying to configure kapacitor to write data to second influxdb instance using tickscript, as below.

var data = stream
|from()
.database(‘telegraf’)
.retentionPolicy(‘autogen’)
.measurement(‘cpu’)
.groupBy(‘host’)
.where(lambda: “cpu” == ‘cpu-total’)

|InfluxDBOut()
.cluster(‘write’)
.create()
.database(‘check_db’)
.measurement(‘check’)

but we are facing the error “No such config write” while enabling the kapacitor task. can anyone please provide a solution for this.

Hi @Sawani_Soman welcome ,

I have seen the same problem before ,
after a restart of kapacitor everything worked as expected ,
was kapacitor restarted after the configuration change ?

best regards ,

Hi @MarcV,

Yes, Kapacitor was restarted after the configuration change.

In docker-compose, using volumes, local kapacitor.config was not getting copied to kapacitor instance config location —> etc/kapacitor/kapacitor.conf. So I used environment variables, to overwrite the kapacitor instance default config file. Please find environment variables assigned in docker-compose file.

kapacitor:
image: kapacitor:1.5
environment:
# KAPACITOR_CONFIG_PATH: /etc/default/kapacitor
KAPACITOR_HOSTNAME: kapacitor
KAPACITOR_INFLUXDB_0_URLS_0: http://influxdb:8086
KAPACITOR_INFLUXDB_1_URLS_1: http://influxdb-write:8087
KAPACITOR_INFLUXDB_1_NAME: write

When I enable task in kapacitor, it says “No such config write” .

Issue was solved, cluster name for influxdb-write was not correct.