Configuring telegraf to send data to different influx databases?

So I have telegraf configured with a default “telegraf” database. In telegraf.d, I have configurations for different inputs and would like for them to send their metrics to different databases for example:

    [[inputs.exec]]
    commands = ["/usr/bin/speedtest -f json-pretty"]
    name_override = "Speedtest"
    timeout = "1m"
    interval = "5m"
    data_format = "json"
    json_string_fields = [ "interface_externalIp",
                           "server_name",
                           "server_location",
                           "server_host",
                           "server_ip",
                           "result_url" ]

#A configuration here pointing to influxdb "speedtest"

So all other input files inside telegraf.d would send data to the default “telegraf” database but this one inputs.exec.

I can provide more information if It doesn’t make sense.

Thank you.

Yes this is possible with measurement filtering.
Below is an example from the documentation.
Must be adapted of course if necessary.

Excellent. Works perfectly! The only downside is that it now writes to both databases. Do I now use namedrop in the configuration pointing to telegraf to drop all of these “speedtest” measurements?

I don’t know exactly what you have in mind, but in principle yes, with namepass and namedrop you could split the data stream to different databases.

1 Like