MQTT Native Collector
MQTT is a machine-to-machine (M2M)/Internet of Things communication protocol designed as a lightweight publish/subscribe messaging tool. MQTT is useful for connections where a small resource footprint is required and/or network bandwidth is at a premium.
MQTT uses a publish/subscribe message pattern which means that client devices connect to a broker which acts as a middleman between those devices. Devices that are connected to the broker can publish messages that will be forwarded to other connected devices via the broker. Each message must have a topic and the broker will only pass messages to devices that have explicitly subscribed to a topic.
Why use the MQTT Native Collector?
The MQTT Native Collector allows you to use InfluxDB to subscribe directly to an MQTT broker, creating a fast and reliable cloud-to-cloud data pipeline.
Many solutions rely on cloud-based technologies, including MQTT brokers. As a result, these solutions may not have a place to install and run a collection agent, such as Telegraf. Incorporating a virtual machine or similar layer can add significant costs, and building a local service to do this adds points of failure, data transfer time, and costs.
How to use the MQTT Native Collector
The Native Collector feature is available with paid accounts in InfluxDB Cloud 2.0.
The MQTT Native Collector involves a simple, three-step configuration process.
- Configure your MQTT broker — Specify the IP address, port, and authentication parameters for your Message Broker
- Configure your MQTT topic(s) — Provide the name(s) for the topic(s) you want to subscribe to
- Define parsing rules — Setup some simple parsing rules to map elements in your messages to measurements, timestamps, fields, and tags in InfluxDB
Additional parsing options include:
- Subscription Wildcards: Use the wildcard characters + and # in your Topic Configuration to dynamically subscribe to one or many specific topics on a particular broker. This adheres to the MQTT Specification for Topic Names and Topic Filters.
- Dynamic Data Routing and Orchestration: Using Subscription Wildcards and Write Destination, you can dynamically route events to different InfluxDB Buckets depending on the broker source.
- JSON and String Parsing: Use JSON Path expressions and Regular Expressions to dynamically parse JSON and string payloads, respectively. Mine your MQTT data for timestamp, measurement, field, and tag sets dynamically, no matter the text format.
InfluxDB starts to ingest data immediately once the configuration process successfully completes.