2016-02-09 22:03:46 +00:00
|
|
|
# MQTT Consumer Input Plugin
|
|
|
|
|
|
|
|
The [MQTT](http://mqtt.org/) consumer plugin reads from
|
|
|
|
specified MQTT topics and adds messages to InfluxDB.
|
|
|
|
The plugin expects messages in the
|
2016-02-18 20:37:36 +00:00
|
|
|
[Telegraf Input Data Formats](https://github.com/influxdata/telegraf/blob/master/docs/DATA_FORMATS_INPUT.md).
|
2016-02-09 22:03:46 +00:00
|
|
|
|
|
|
|
### Configuration:
|
|
|
|
|
|
|
|
```toml
|
|
|
|
# Read metrics from MQTT topic(s)
|
|
|
|
[[inputs.mqtt_consumer]]
|
|
|
|
servers = ["localhost:1883"]
|
2016-02-18 21:26:51 +00:00
|
|
|
## MQTT QoS, must be 0, 1, or 2
|
2016-02-09 22:03:46 +00:00
|
|
|
qos = 0
|
|
|
|
|
2016-02-18 21:26:51 +00:00
|
|
|
## Topics to subscribe to
|
2016-02-09 22:03:46 +00:00
|
|
|
topics = [
|
|
|
|
"telegraf/host01/cpu",
|
|
|
|
"telegraf/+/mem",
|
|
|
|
"sensors/#",
|
|
|
|
]
|
|
|
|
|
2016-02-18 21:26:51 +00:00
|
|
|
## Maximum number of metrics to buffer between collection intervals
|
2016-02-09 22:03:46 +00:00
|
|
|
metric_buffer = 100000
|
|
|
|
|
2016-02-18 21:26:51 +00:00
|
|
|
## username and password to connect MQTT server.
|
2016-02-09 22:03:46 +00:00
|
|
|
# username = "telegraf"
|
|
|
|
# password = "metricsmetricsmetricsmetrics"
|
|
|
|
|
2016-02-18 21:26:51 +00:00
|
|
|
## Optional SSL Config
|
2016-02-09 22:03:46 +00:00
|
|
|
# ssl_ca = "/etc/telegraf/ca.pem"
|
|
|
|
# ssl_cert = "/etc/telegraf/cert.pem"
|
|
|
|
# ssl_key = "/etc/telegraf/key.pem"
|
2016-02-18 21:26:51 +00:00
|
|
|
## Use SSL but skip chain & host verification
|
2016-02-09 22:03:46 +00:00
|
|
|
# insecure_skip_verify = false
|
|
|
|
|
2016-04-05 20:42:20 +00:00
|
|
|
## Data format to consume.
|
2016-02-18 21:26:51 +00:00
|
|
|
## Each data format has it's own unique set of configuration options, read
|
|
|
|
## more about them here:
|
|
|
|
## https://github.com/influxdata/telegraf/blob/master/docs/DATA_FORMATS_INPUT.md
|
2016-02-09 22:03:46 +00:00
|
|
|
data_format = "influx"
|
|
|
|
```
|
|
|
|
|
|
|
|
### Tags:
|
|
|
|
|
|
|
|
- All measurements are tagged with the incoming topic, ie
|
|
|
|
`topic=telegraf/host01/cpu`
|