Telegraf writes but nothing in Data Explorer !? [Solved]

Desperate newbie here! I have set up telegraf on my machine to read an mqtt broker and write to Influxdb Cloud (stripped config below). When I check in the Data Explorer, the bucket can be selected, the tags and fields show up to use as filters, but no matter what button I push or what lever I pull I only get “No Results” in the Data Explorer.

My belief was that if Data Explorer knows about the measurement, tags and fields of some bucket, some data must have been written. Even telegraf in debug mode says “Wrote batch of X metrics” (se below).

I guess there is a real newbie goof here, but I don’t know were go, north/south, up/down or home? Can anyone point me in the right direction to find the elusive data?

Dan

Telegraf run

aserver:~ $ telegraf --debug --config telegraf.conf
2022-08-05T09:14:40Z I! Starting Telegraf 1.23.3
2022-08-05T09:14:40Z I! Loaded inputs: mqtt_consumer
2022-08-05T09:14:40Z I! Loaded aggregators: 
2022-08-05T09:14:40Z I! Loaded processors: 
2022-08-05T09:14:40Z I! Loaded outputs: influxdb_v2
2022-08-05T09:14:40Z I! Tags enabled: host=haserver site=vendelso
2022-08-05T09:14:40Z I! [agent] Config: Interval:10s, Quiet:false, Hostname:"haserver", Flush Interval:10s
2022-08-05T09:14:40Z D! [agent] Initializing plugins
2022-08-05T09:14:40Z D! [agent] Connecting outputs
2022-08-05T09:14:40Z D! [agent] Attempting connection to [outputs.influxdb_v2]
2022-08-05T09:14:40Z D! [agent] Successfully connected to outputs.influxdb_v2
2022-08-05T09:14:40Z D! [agent] Starting service inputs
2022-08-05T09:14:40Z I! [inputs.mqtt_consumer] Connected [tcp://localhost:1883]
2022-08-05T09:14:50Z D! [outputs.influxdb_v2] Buffer fullness: 0 / 10000 metrics
2022-08-05T09:15:00Z D! [outputs.influxdb_v2] Wrote batch of 3 metrics in 343.251584ms
2022-08-05T09:15:00Z D! [outputs.influxdb_v2] Buffer fullness: 0 / 10000 metrics
2022-08-05T09:15:10Z D! [outputs.influxdb_v2] Buffer fullness: 0 / 10000 metrics
2022-08-05T09:15:20Z D! [outputs.influxdb_v2] Buffer fullness: 0 / 10000 metrics
2022-08-05T09:15:30Z D! [outputs.influxdb_v2] Buffer fullness: 0 / 10000 metrics
2022-08-05T09:15:40Z D! [outputs.influxdb_v2] Wrote batch of 1 metrics in 138.122837ms
2022-08-05T09:15:40Z D! [outputs.influxdb_v2] Buffer fullness: 0 / 10000 metrics
^C
2022-08-05T09:15:43Z D! [agent] Stopping service inputs
2022-08-05T09:15:43Z D! [inputs.mqtt_consumer] Disconnecting [tcp://localhost:1883]
2022-08-05T09:15:43Z D! [inputs.mqtt_consumer] Disconnected [tcp://localhost:1883]
2022-08-05T09:15:43Z D! [agent] Input channel closed
2022-08-05T09:15:43Z I! [agent] Hang on, flushing any cached metrics before shutdown
2022-08-05T09:15:43Z D! [outputs.influxdb_v2] Buffer fullness: 0 / 10000 metrics
2022-08-05T09:15:43Z I! [agent] Stopping running outputs
2022-08-05T09:15:43Z D! [agent] Stopped Successfully

telegraf.conf (stripped of comments)

aserver:~ $ grep -v "^\s*[#;]" telegraf.conf | grep -v "^\s*$"
[global_tags]
  site = "vendelso"
[agent]
  interval = "10s"
  round_interval = true
  metric_batch_size = 1000
  metric_buffer_limit = 10000
  collection_jitter = "0s"
  flush_interval = "10s"
  flush_jitter = "0s"
  precision = "0s"
  hostname = ""
  omit_hostname = false
[[outputs.influxdb_v2]]
  urls = ["${INFLUXDB_URL}"]
  token = "${INFLUXDB_TOKEN}"
  organization = "${INFLUXDB_ORG}"
  bucket = "${INFLUXDB_BUCKET}"
[[inputs.mqtt_consumer]]
  servers = ["${MQTT_BROKER_SERVER}"]
  topics = ["home/sensors/eurochron"]
  connection_timeout = "60s"
  name_override = "eurochron-sensors"
  data_format = "json"
  tag_keys = ["channel"]
  json_time_key = "time"
  json_time_format = "2006-01-02T15:04:05"
  
Here's what comes out of the MQTT broker, as seen by mosquitto_sub
  
  home/sensors/eurochron {"time":"2022-08-05T11:38:21","model":"Eurochron-EFTH800","id":836,"channel":2,"battery_ok":1,"temperature_C":30.5,"humidity":31,"mic":"CRC"}

Seems it was the time format. Changing the Broker output to Unix-time and the JSON-configuration to “unix time format” solved the issue. Phew !

1 Like

Hello @dstahlberg,
I’m glad you figured it out and thank you for sharing your solution.