Telegraf multiple input to multiple influxdb v2 buckets

Hello,
To date I retrieve VMware info from 3 datacenters on the same bucket. The problem is that via Grafana it’s relatively slow.
I would therefore like to separate the datacenters on 3 buckets
DC1 → Bucket1
DC2 → bucket2
DC3 → Bucket3
I tried via bucket_tag, but I can’t.

[[outputs.influxdb_v2]]
  urls = ["http://127.0.0.1:8086"]
  token = "xxxxxxx"
  organization = "xxxxxx"
  bucket = "bucket1"
  bucket_tag = "bucket1"
  exclude_bucket_tag = false
  user_agent = "telegraf_bucket1"

[[inputs.vsphere]]
  vcenters = [ "xxxxxxx/sdk" ]
  username = "xxxxxxx@vsphere.local"
  password = "xxxxxxx"
  [inputs.vsphere.tags]
    bucket = "bucket1"

3 identical files in /etc/telegraf/telegraf.d/DC1.conf, 2 and 3 with Bucket1 Bucket2 and Bucket3
But this does not return data on all buckets
What am I doing wrong?

If you could help me solve this routing of inputs to target buckets.

Franpom

There is a very similar question here. Anyway, leave your inputs as they are, adding the tag bucket="bucket1", bucket="bucket2" and bucket="bucket3". Then you can use

[[outputs.influxdb_v2]]
  urls = ["http://127.0.0.1:8086"]
  token = "xxxxxxx"
  organization = "xxxxxx"
  bucket = "bucket_for_remaining_data"
  bucket_tag = "bucket"
  exclude_bucket_tag = false
  user_agent = "telegraf_bucket1"

The output plugin will then use the value of the tag bucket to determine which bucket to use. This only works for influxdb_v2. Alternatively, you can create three output instances and use metric filtering

[[outputs.influxdb_v2]]
  urls = ["http://127.0.0.1:8086"]
  token = "xxxxxxx"
  organization = "xxxxxx"
  bucket = "bucket1"
  user_agent = "telegraf_bucket1"
  
  [outputs.influxdb_v2.tagpass]
    bucket = ["bucket1"]

[[outputs.influxdb_v2]]
  urls = ["http://127.0.0.1:8086"]
  token = "xxxxxxx"
  organization = "xxxxxx"
  bucket = "bucket2"
  user_agent = "telegraf_bucket1"
  
  [outputs.influxdb_v2.tagpass]
    bucket = ["bucket2"]

[[outputs.influxdb_v2]]
  urls = ["http://127.0.0.1:8086"]
  token = "xxxxxxx"
  organization = "xxxxxx"
  bucket = "bucket3"
  user_agent = "telegraf_bucket1"
  
  [outputs.influxdb_v2.tagpass]
    bucket = ["bucket3"]

I have similar issues .
[[inputs.vsphere]]

List of vCenter URLs to be monitored. These three lines must be uncommented

and edited for the plugin to work.

vcenters = [ “https://vcs0/sdk”, “https://vcs1/sdk”, “https://vcs2/sdk”]
username = “grafuser@ing.local”
password = “xxxxx”
[intputs.vsphere.tags]
bucket = “bucket1”

interval = “20s”
insecure_skip_verify = true
force_discover_on_init = true

[[outputs.influxdb_v2]]
urls = [“http://127.0.0.1:8086”]
token = “Wxxxxxxxxxxxxxxxxxx”
organization = “ing”
bucket = “vmware”

[outputs.influxdb_v2.tagpass]
bucket = [“bucket1”]

whit this configuration , telegraf servis won’t start
Job for telegraf.service failed because the control process exited with error code.
See “systemctl status telegraf.service” and “journalctl -xeu telegraf.service” for details.

whitout tags it’s work fine

@zare_z please put the

[intputs.vsphere.tags]
bucket = “bucket1”

part of your config to the end of your inputs.vsphere section! Otherwise the TOML syntax will assign all following options (interval, insecure_skip_verify and force_discover_on_init) to the tags table. This is a TOML oddity as tables implicitly only end if a new table or array ([[...]]) starts…

1 Like