Can you send Input Metrics to different databases from Telegraf?

Is it possible to send to Input Metrics to different Databases? Example a single Telegraf configured to send SNMP to database “A”, send IPMI to database “B” and Vsphere to database “C”. Currently I have this happening by setting up 3 different “collector” virtual machines. It would be nice just to have it in a single machine.

Hello @fastxl,
Great question.

The 3 current best workarounds are:

  • use name_override, name_suffix, or name_prefix config options to prepend names to your measurements on the input-side, then use namepass to route to outputs, ie:
[[inputs.exec]]
  # ...
  name_prefix = "exec1_"

[[inputs.exec]]
  # ...
  name_prefix = "exec2_"

# this influxdb will only get exec1
[[outputs.influxdb]]
  # ...
  namepass = "exec1_*"

# this will only get exec2
[[outputs.influxdb]]
  # ...
  namepass = "exec2_*"
  • Use tags, tagdrop, tagpass routing
  • Run multiple telegraf processes.

From #1778

2 Likes

Hello Anaisdg,
Is this option possible for another inputs like Ping or http_response???
Moreover, i tried to insert these entries following your example but still failed to restart telegraf.
These are my inputs, please take a look and give me some advises. Thanks

  • MTR
    [[inputs.exec]]
    interval = “60s”
    commands=[“mtr -4Cn www.google.com”]
    timeout = “45s”
    data_format = “csv”
    csv_skip_rows = 1
    csv_column_names=[“”, “”, “status”, “dest”, “hop”, “ip”, “loss”, “snt”, “”, “”, “avg”, “best”, “worst”, “stdev”]
    name_override = “mtr”
    name_prefix = “exec1_”
    csv_tag_columns = [“dest”, “hop”, “ip”]
    [[outputs.influxdb]]
    namepass = “exec_*”
    urls = [“http://localhost:8086”]
    database = “ABC”
    write_consistency = “any”
    timeout = “45s”
    username = “ABC”
    password = “ABC123”

Yes it is possible.

What is the error message?

Did you already resolve the problem? The name_prefix and namepass are not the same. On the namepass you missed the number 1.

Thanks Manuel, it has been worked.

Hi, Can I have different machine and their telegraf config output set to same urls? In my scenarios, I will have multiple station running some test, would like to collect all their data to one machine only. Then from there, display the information on one chronograf.