# Configuration for telegraf agent
[agent]

  interval = "10s"
  round_interval = true

  metric_batch_size = 1000

  metric_buffer_limit = 10000

  collection_jitter = "0s"

  flush_interval = "10s"
  flush_jitter = "0s"

  precision = ""


  ## Override default hostname, if empty use os.Hostname()
  hostname = ""
  ## If set to true, do no set the "host" tag in the telegraf agent.
  omit_hostname = false
[[outputs.influxdb_v2]]
  ## The URLs of the InfluxDB cluster nodes.

  urls = ["http://influx-influxdb-1:8086"]

  ## Token for authentication.
  token = "1wml0Wzrno-VPHxw0N4CSJh42aTAE-zCCAnAj8BLY_YxsmexXO6_8o7i1HDdAPzDUndCCsejWKq9GJXeYFDhpQ=="

  ## Organization is the name of the organization you wish to write to; must exist.
  organization = "Bischoffsheim"

  ## Destination bucket to write into.
  bucket = "Temperaturen"

[[inputs.mqtt_consumer]]
  servers = ["tcp://mqtt5:1883"]
  topics  = ["daten/status/+"]          # deckt "daten/status/temperature:100" ab
  qos = 1
  persistent_session = true
  client_id = "telegraf_mqtt_influx3"
  username = "${MQTT_USERNAME}"
  password = "${MQTT_PASSWORD}"
  topic_tag = "topic"

  data_format = "json_v2"

  [[inputs.mqtt_consumer.json_v2]]
    measurement_name = "temperature"

    # id als Tag (saubere Gruppierung / Filter in Influx)
    [[inputs.mqtt_consumer.json_v2.tag]]
      path   = "id"
      rename = "sensor_id"
      type   = "int"

    # Felder
    [[inputs.mqtt_consumer.json_v2.field]]
      path   = "tC"
      rename = "tC"
      type   = "float"

    [[inputs.mqtt_consumer.json_v2.field]]
      path   = "tF"
      rename = "tF"
      type   = "float"