I’m just getting started w/ influx and telegraf and I’m running into issues with collecting and tagging data. I’m looking to field air quality monitors which will send readings and device info via MQTT. I’ve successfully setup an [[inputs.mqtt_consumer]]
using data_format="value"
to pull the readings from MQTT into influx. However, I want more control over the tagging and so I’m now attempting to use JSON-formatted data without much success. The telgraf service runs without error, but no data is submitted to the database with the settings shown below. Reverting back to data_fromat="value"
with readings split out into separate topics works as expected.
I’m probably just doing something dumb here but I’ve yet to figure out the magic configuration to make all this work. If anyone could offer some guidance I sure would appreciate it.
Here’s the data being published to MQTT:
topic: graqmpublish/graqm005
message: {"device":"graqm005","geohash":"dpe5eqr5","transport":"WiFi","PM1":"2","PM25":"3","PM10":"4","O3":"152","pressure":"29.47","humidity":"44.91","temperature":"22.21"}
Here’s the input plugin configuration from telegraf.conf
:
# Read metrics from MQTT topic(s)
[[inputs.mqtt_consumer]]
name_override = "graqm_airquality"
servers = ["localhost:1883"]
qos = 0
connection_timeout = 30
topics = [
"graqpublish/#",
]
persistent_session = true
client_id = "graqmdata-telegraf"
data_format = "json"
tag_keys = [
"device",
"geohash",
"transport"
]
Output from systemctl status telegraf
Oct 01 11:57:35 graqmdata telegraf[12355]: 2017-10-01T15:57:35Z I! Starting Telegraf v1.4.1
Oct 01 11:57:35 graqmdata telegraf[12355]: 2017-10-01T15:57:35Z I! Loaded outputs: influxdb
Oct 01 11:57:35 graqmdata telegraf[12355]: 2017-10-01T15:57:35Z I! Loaded inputs: inputs.mqtt_consumer
Oct 01 11:57:35 graqmdata telegraf[12355]: 2017-10-01T15:57:35Z I! Tags enabled: host=graqmdata
Oct 01 11:57:35 graqmdata telegraf[12355]: 2017-10-01T15:57:35Z I! Agent Config: Interval:10s, Quiet:false, Hostname:"graqmdata", Flush Interval:10s
Oct 01 11:57:35 graqmdata telegraf[12355]: 2017-10-01T15:57:35Z I! MQTT Client Connected