Routing through bucket tag

103 Views Asked by At

I try to configure Telegraf to route data from MQTT, optionally through an aggregator, to InfluxDB:

  • raw data should go straight to bucket raw
  • statistics should go to bucket stats

My telegraf.conf looks like (simplified):

[[inputs.mqtt_consumer]]
  servers = ["tcp://127.0.0.1:1883"]
  topics = ["..."]
  qos = 0
  tagexclude = ["topic"]
  client_id = "telegraf"
  tags = {channel = "raw", bucket="raw"}

[[aggregators.basicstats]]
  period = "30s"
  precision = "30s"
  drop_original = false
  tags = {bucket = "stats"}
  stats = ["mean", "sum"]
  [aggregators.basicstats.tagpass]
    channel = [ "raw" ]

[[outputs.influxdb_v2]]
  urls = ["http://localhost:8086"]
  token = "..."
  organization = "..."
  bucket_tag = "bucket"
  tagexclude = ["channel"]
  [outputs.influxdb_v2.tagpass]
    bucket = ["raw", "stats" ]

For some reason all data ends up in de raw bucket, while nothing gets to stats. Even if I reverse the order of the buckets on the last line.

When I remove the bucket tag from the MQTT consumer, nothing gets written at all.

What am I doing wrong? Any suggestion would be greatly appreciated.

0

There are 0 best solutions below