influxdata / telegraf

Agent for collecting, processing, aggregating, and writing metrics, logs, and other arbitrary data.
https://influxdata.com/telegraf
MIT License
14.61k stars 5.57k forks source link

JSON parser ignoring boolean values #6398

Closed heinrichnak closed 5 years ago

heinrichnak commented 5 years ago

Relevant telegraf.conf:

[[inputs.mqtt_consumer]]
   servers = ["tcp://localhost:1883"]
   topics = [
     "events/central_heating/otmonitor/flame",
   ]
   data_format = "json"
   data_type = "boolean"
   name_override = "flame"
   name_prefix = "otgw_"
   json_string_fields = [
     "value",
   ]
   interval = "10s"

System info:

Telegraf version 1.12.1 on Ubuntu 18.04.3 LTS

Steps to reproduce:

  1. Read boolean type of JSON message from a MQTT topic

Expected behavior:

Store boolean in influxdb:

> select * from otgw_flame
name: otgw_flame
time                host   timestamp     topic                                  value
----                ----   ---------     -----                                  -----
1568614387211376524 ubuntu 1568611817541 events/central_heating/otmonitor/flame true

Actual behavior:

Only the timestamp is stored, not the boolean value:

> select * from otgw_flame
name: otgw_flame
time                host   timestamp     topic
----                ----   ---------     -----
1568614387211376524 ubuntu 1568611817541 events/central_heating/otmonitor/flame

Additional info:

This used to work until version 1.12.0, so it seems that something introduced in 1.12.0 broke this.

This is the message from MQTT perspective:

# mosquitto_sub -t events/central_heating/otmonitor/flame
{"name": "on", "type": "boolean", "value": false, "timestamp": 1568611817541}
glinton commented 5 years ago

It appears this functionality was removed in 41176dd

heinrichnak commented 5 years ago

Thanks! Works fine again.