Faster MQTT data collection with InfluxDB

0

MQTT is a powerhouse in the Internet of Things (IoT) space. Its pub/sub model and lack of a defined payload structure make it infinitely adaptable to the needs of modern sensors, devices and systems. IoT data is also time series data. Time-stamped data allows businesses and applications to track historical and real-time changes, and can also aid in forecasting and prediction.

InfluxDB has just introduced a new Native Collector feature designed to speed up collection from cloud-based pub/sub services. The first integration available for this new feature is the native MQTT Collector.

Native MQTT allows InfluxDB users to subscribe to MQTT topics directly from the InfluxDB Cloud interface. The InfluxDB Cloud service then communicates directly with its MQTT broker to immediately begin receiving any messages posted on these topics.

Configuring native MQTT

Native MQTT is easy to set up and requires no additional software to be installed in your software stack or custom coding. It’s a true no-code solution. So let’s look at the basic setup, as well as some of the additional scanning options available to you.

For MQTT data to flow through your InfluxDB instance, Native MQTT requires three basic configuration steps.

  1. Broker contact details: Specify the IP address, port, and authentication settings for your MQTT message broker.
  2. Subject name: Indicate the name(s) of the subject(s) to which you wish to subscribe.
  3. Analysis rules: Configure parsing rules to map elements of your MQTT messages to the various elements of InfluxDB’s line protocol data model: metrics, timestamps, fields, and tags.

Boom! That’s it.

Data analysis options

When it comes to data analysis, you have several options. MQTT allows the use of wildcards. The + and # wildcards allow you to dynamically subscribe to one or more specific topics on a particular broker. This use of wildcards follows the MQTT specification for topic names and topic filters.

You can even combine wildcards with specific write destinations to optimize your MQTT broker workflows. This allows you to dynamically write data from specific topics to specific InfluxDB buckets. For example, you can write all energy-related topic data to an “Energy” bucket and all weather-related topic data to a “Weather” bucket.

Finally, since MQTT allows unstructured data payloads, the Native MQTT feature lets you dynamically parse JSON and strong payloads using JSON path expressions and regular expressions, respectively. This means you can extract your MQTT data for timestamp, measure, field and tag sets regardless of the text format.

The typical setup only takes a few minutes. Once complete, all messages published to your MQTT broker will be transmitted to InfluxDB as time series data. At this point, you can run any necessary queries, visualizations, and alerts, or configure additional tasks and transformations on your data using the Flux scripting language.

Conclusion

Native MQTT gives developers a way to collect time series data in the cloud in a single step. Eliminating the need to write custom code, orchestrate additional layers of technology, or incorporate additional hosting services means developers can spend more time actually using their collected data and less time setting it up or manage the infrastructure.

For users who want or need a truly managed, serverless, cloud-to-cloud solution, Native MQTT provides it.

To learn more about Native MQTT and InfluxDB, visit the InfluxDB Native Collectors page.

Want to use Python with InfluxDB and MQTT? Check out this Python MQTT tutorial.

Band Created with Sketch.
Share.

Comments are closed.