I set up tags in my Telegraf config in order to route the input to the right output. Config looks like:
[[outputs.influxdb]]
tagexclude = ["influxdb_database"]
[outputs.influxdb.tagpass]
influxdb_database = ["e2e_service_mon"]
[[outputs.influxdb]]
[outputs.influxdb.tagdrop]
influxdb_database = ["*"]
[[inputs.ping]]
urls = ["amazon.com"]
[inputs.ping.tags]
tag1 = "dummy1"
tag2 = "dummy2"
influxdb_database = "e2e_service_mon"
[[inputs.cpu]]
## Whether to report per-cpu stats or not
percpu = true
## Whether to report total system cpu stats or not
totalcpu = true
## If true, collect raw CPU time metrics.
collect_cpu_time = false
## If true, compute and report the sum of all non-idle CPU states.
report_active = false
Telegraf log shows:
2019-03-04T06:45:40Z E! Error writing to output [influxdb]: could not write any address
2019-03-04T06:45:40Z D! Output [influxdb] buffer fullness: 379 / 10000 metrics.
2019-03-04T06:45:40Z E! [outputs.influxdb] when writing to [http://localhost:8086]: Post http://localhost:8086/write?db=telegraf: dial tcp 127.0.0.1:8086: connect: connection refused
2019-03-04T06:45:40Z E! Error writing to output [influxdb]: could not write any address
2019-03-04T06:45:50Z D! Output [influxdb] buffer fullness: 379 / 10000 metrics.
2019-03-04T06:45:50Z D! Output [influxdb] buffer fullness: 120 / 10000 metrics.
2019-03-04T06:45:50Z E! [outputs.influxdb] when writing to [http://localhost:8086]: Post http://localhost:8086/write?db=telegraf: dial tcp 127.0.0.1:8086: connect: connection refused
2019-03-04T06:45:50Z E! Error writing to output [influxdb]: could not write any address
2019-03-04T06:45:50Z E! [outputs.influxdb] when writing to [http://localhost:8086]: Post http://localhost:8086/write?db=telegraf: dial tcp 127.0.0.1:8086: connect: connection refused
2019-03-04T06:45:50Z E! Error writing to output [influxdb]: could not write any address
Note, that the tcp influxdb output is not even existing in the confi file, no idea why it pops up like this in the log.
The issue is, that I don’t get any data in Influxdb, not in the servermetrics db nor in the e2e_service_mon from this host, other hosts without the routing tags are working.
Hi , I think that is because the urls part is misssing in the [[outputs.influxdb]] section ?
The tcp Influxdb output is the default that is why you see it in the logs …
Hope this helps , have a good workweek
Routing metrics to different outputs based on the input. Metrics are tagged with influxdb_database in the input, which is then used to select the output. The tag is removed in the outputs before writing.