telegraf/plugins/outputs/mqtt/README.md

64 lines
2.3 KiB
Markdown
Raw Normal View History

2018-02-16 21:51:20 +00:00
# MQTT Producer Output Plugin
This plugin writes to a [MQTT Broker](http://http://mqtt.org/) acting as a mqtt Producer.
2018-04-12 21:34:55 +00:00
```toml
2018-02-16 21:51:20 +00:00
[[outputs.mqtt]]
## URLs of mqtt brokers
servers = ["localhost:1883"]
2018-04-12 21:34:55 +00:00
2018-02-16 21:51:20 +00:00
## topic for producer messages
2018-04-12 21:34:55 +00:00
topic_prefix = "telegraf"
2018-02-16 21:51:20 +00:00
## QoS policy for messages
2018-05-19 02:03:00 +00:00
## 0 = at most once
## 1 = at least once
## 2 = exactly once
2018-02-16 21:51:20 +00:00
qos = 2
2018-04-12 21:34:55 +00:00
2018-02-16 21:51:20 +00:00
## username and password to connect MQTT server.
# username = "telegraf"
# password = "metricsmetricsmetricsmetrics"
2018-04-12 21:34:55 +00:00
2018-02-16 21:51:20 +00:00
## client ID, if not set a random ID is generated
# client_id = ""
2018-04-12 21:34:55 +00:00
2018-02-16 21:51:20 +00:00
## Timeout for write operations. default: 5s
# timeout = "5s"
2018-04-12 21:34:55 +00:00
2018-05-04 23:33:23 +00:00
## Optional TLS Config
# tls_ca = "/etc/telegraf/ca.pem"
# tls_cert = "/etc/telegraf/cert.pem"
# tls_key = "/etc/telegraf/key.pem"
## Use TLS but skip chain & host verification
2018-02-16 21:51:20 +00:00
# insecure_skip_verify = false
2019-02-12 01:25:25 +00:00
2018-05-19 02:03:00 +00:00
## When true, metrics will be sent in one MQTT message per flush. Otherwise,
## metrics are written one metric per MQTT message.
2018-05-19 01:55:02 +00:00
# batch = false
2019-02-12 01:25:25 +00:00
## When true, messages will have RETAIN flag set.
# retain = false
2018-05-19 01:55:02 +00:00
2018-02-16 21:51:20 +00:00
## Data format to output.
2018-05-19 02:03:00 +00:00
# data_format = "influx"
2018-02-16 21:51:20 +00:00
```
### Required parameters:
* `servers`: List of strings, this is for speaking to a cluster of `mqtt` brokers. On each flush interval, Telegraf will randomly choose one of the urls to write to. Each URL should just include host and port e.g. -> `["{host}:{port}","{host2}:{port2}"]`
* `topic_prefix`: The `mqtt` topic prefix to publish to. MQTT outputs send metrics to this topic format "<topic_prefix>/<hostname>/<pluginname>/" ( ex: prefix/web01.example.com/mem)
* `qos`: The `mqtt` QoS policy for sending messages. See https://www.ibm.com/support/knowledgecenter/en/SSFKSJ_9.0.0/com.ibm.mq.dev.doc/q029090_.htm for details.
### Optional parameters:
* `username`: The username to connect MQTT server.
* `password`: The password to connect MQTT server.
* `client_id`: The unique client id to connect MQTT server. If this parameter is not set then a random ID is generated.
2018-02-16 21:51:20 +00:00
* `timeout`: Timeout for write operations. default: 5s
2018-05-04 23:33:23 +00:00
* `tls_ca`: TLS CA
* `tls_cert`: TLS CERT
* `tls_key`: TLS key
* `insecure_skip_verify`: Use TLS but skip chain & host verification (default: false)
2019-02-12 01:25:25 +00:00
* `retain`: Set `retain` flag when publishing
2018-02-16 21:51:20 +00:00
* `data_format`: [About Telegraf data formats](https://github.com/influxdata/telegraf/blob/master/docs/DATA_FORMATS_OUTPUT.md)