I have two configs with separate credentials set up to intake MQTT from TTN and Put them into two separate buckets. Im seeing data from both configs going into both buckets. is there any way to debug this?
Hello @Derek_Tuando,
Welcome!
Whats the problem? Data isn’t separating/splitting to two buckets?
Can you please share your config?
Do you have multiple outputs in your config?
Youll want to use tagpass or tagdrop to route data. Something like:
# Input for data source 1
[[inputs.cpu]]
## Add a distinguishing tag
[inputs.cpu.tags]
data_source = "source_1"
# Input for data source 2
[[inputs.mqtt_consumer]]
servers = ["tcp://localhost:1883"]
topics = ["sensors/temperature"]
data_format = "json"
[inputs.mqtt_consumer.tags]
data_source = "source_2"
# Output for the first bucket
[[outputs.influxdb_v2]]
urls = ["http://localhost:8086"]
token = "your_first_token"
organization = "your_org"
bucket = "bucket_one"
## Only pass data where the data_source tag matches "source_1"
[outputs.influxdb_v2.tagpass]
data_source = ["source_1"]
# Output for the second bucket
[[outputs.influxdb_v2]]
urls = ["http://localhost:8086"]
token = "your_second_token"
organization = "your_org"
bucket = "bucket_two"
## Only pass data where the data_source tag matches "source_2"
[outputs.influxdb_v2.tagpass]
data_source = ["source_2"]
Or something like
# Input for data source 1
[[inputs.cpu]]
## No need to add any tags here
# Input for data source 2
[[inputs.mqtt_consumer]]
servers = ["tcp://localhost:1883"]
topics = ["sensors/temperature"]
data_format = "json"
## No need to add any tags here
# Output for the first bucket
[[outputs.influxdb_v2]]
urls = ["http://localhost:8086"]
token = "your_first_token"
organization = "your_org"
bucket = "bucket_one"
## Drop data from the second data source
[outputs.influxdb_v2.tagdrop]
mqtt_topic = ["sensors/temperature"] # Drop data from the MQTT source
# Output for the second bucket
[[outputs.influxdb_v2]]
urls = ["http://localhost:8086"]
token = "your_second_token"
organization = "your_org"
bucket = "bucket_two"
## Drop data from the first data source (e.g., CPU metrics)
[outputs.influxdb_v2.tagdrop]
cpu = ["*"] # Drop all CPU metrics
I hope this helps!
Yes I have two configs in telegraf.d folder…
CONFIG #1:
[[inputs.mqtt_consumer]]
servers = ["mqtts://:example.com:8883"]
topics = ["v3/APPLICATION_ID/devices/+/up"]
client_id = "CLIENT 1"
username = "APPLICATION ID_1"
password = "API_KEY"
data_format = "json"
[[outputs.influxdb_v2]]
urls = ["http://localhost:8086"]
token = "API_TOKEN"
organization = "ORG NAME"
bucket = "bucket_one"
CONFIG #2:
[[inputs.mqtt_consumer]]
servers = [“mqtts://:example.com:8883”]
topics = [“v3/APPLICATION_ID_2/devices/+/up”]
client_id = “CLIENT 2”
username = “APPLICATION ID_2”
password = “API_KEY_2”
data_format = “json”
[[outputs.influxdb_v2]]
urls = [“http://localhost:8086"]
token = “API_TOKEN_2”
organization = “ORG NAME”
bucket = “bucket_two”
They both end up in each others buckets.
Still having this issue can anyone help me solve this?
Hello @Derek_Tuando,
By default telegraf loads all configurations in the telegraf.d
folder and merges them into a single instance
You can either:
- Run each seperately:
telegraf --config telegraf_instance1.conf
telegraf --config telegraf_instance2.conf
- Or this is the better option but route metrics with namepass or name_overide
Telegraf Best Practices: Config Recommendations and Performance Monitoring | InfluxData
Check out the routing sections