MQTT and MariaDB Integration
Powerful performance with an easy integration, powered by Telegraf, the open source data connector built by InfluxData.
5B+
Telegraf downloads
#1
Time series database
Source: DB Engines
1B+
Downloads of InfluxDB
2,800+
Contributors
Table of Contents
Powerful Performance, Limitless Scale
Collect, organize, and act on massive volumes of high-velocity data. Any data is more valuable when you think of it as time series data. with InfluxDB, the #1 time series platform built to scale with Telegraf.
See Ways to Get Started
Input and output integration overview
<p>The MQTT Telegraf plugin is designed to read from specified MQTT topics and create metrics, enabling users to leverage MQTT for real-time data collection and monitoring.</p>
<p>This plugin writes metrics from Telegraf directly into MariaDB using parameterized SQL INSERT statements, offering a flexible way to store metrics in structured, relational tables.</p>
Integration details
MQTT
<p>The MQTT plugin allows for reading metrics from specified MQTT topics, creating metrics using supported input data formats. This plugin operates as a service input, which listens for incoming metrics or events rather than gathering them at set intervals like normal plugins. The flexibility of the plugin is enhanced with support for various broker URLs, topics, and connection features, including Quality of Service (QoS) levels and persistent sessions. Its configuration options incorporate global settings to modify metrics and handle startup errors effectively. It also supports secret-store configurations for securing username and password options, ensuring secure connections to MQTT servers.</p>
MariaDB
<p>The SQL output plugin in Telegraf enables direct writing of metrics into SQL-compatible databases like MariaDB by executing parameterized SQL statements. With support for the MySQL driver, the plugin seamlessly integrates with MariaDB for reliable, structured metric storage. This setup is ideal for users who prefer SQL-based analytics or want to store metrics alongside business data for unified querying. MariaDB is a community-developed, enterprise-grade fork of MySQL that emphasizes performance, security, and openness. The plugin supports inserting time series metrics into custom schemas, enabling flexible analytics and integrations with BI tools like Metabase or Grafana using SQL connectors.</p>
Configuration
MQTT
MariaDB
Input and output integration examples
MQTT
<ol> <li> <p><strong>Smart Home Monitoring</strong>: Use the MQTT Consumer plugin to monitor various sensors in a smart home setup. In this scenario, the plugin can be configured to subscribe to topics for different devices, such as temperature, humidity, and energy consumption. By aggregating this data, homeowners can visualize trends and receive alerts for unusual patterns, enhancing the overall quality and efficiency of home automation systems.</p> </li> <li> <p><strong>IoT Environmental Sensing</strong>: Deploy the MQTT Consumer to gather environmental data from sensors distributed across different locations. For instance, this can include readings from air quality sensors, temperature sensors, and noise level meters. The plugin can be configured to extract relevant tags and fields from the MQTT topics which allows for detailed analyses and reporting on environmental conditions at scale, supporting better decision making for urban planning or environmental initiatives.</p> </li> <li> <p><strong>Real-Time Vehicle Tracking and Telemetry</strong>: Integrate the MQTT Consumer plugin within a vehicle telemetry system that collects data from various sensors in real-time. With the plugin, metrics related to vehicle performance, location, and fuel consumption can be sent to a centralized monitoring dashboard. This real-time telemetry data enables fleet managers to optimize routes, reduce fuel costs, and improve vehicle maintenance schedules through proactive data analysis.</p> </li> <li> <p><strong>Agricultural Monitoring System</strong>: Leverage this plugin to collect data from agricultural sensors that monitor soil moisture, crop health, and weather conditions. The MQTT Consumer can subscribe to multiple topics associated with farming equipment and environmental sensors, allowing farmers to make data-driven decisions to improve crop yields while also conserving resources, enhancing sustainability in agriculture.</p> </li> </ol>
MariaDB
<ol> <li> <p><strong>Business Intelligence Integration</strong>: Store application performance metrics directly into MariaDB and connect it to BI tools like Metabase or Apache Superset. This setup allows blending of operational data with business KPIs for unified dashboards, enhancing visibility across departments.</p> </li> <li> <p><strong>Compliance Reporting with Historical Metrics</strong>: Use this plugin to log metrics into MariaDB for audit and compliance use cases. The relational model enables precise querying of past performance indicators with timestamped entries, supporting regulatory documentation.</p> </li> <li> <p><strong>Custom Alerting Based on SQL Logic</strong>: Insert metrics into MariaDB and use custom SQL queries to define alert thresholds or conditions. Combined with cron jobs or scheduled scripts, this enables advanced alerting workflows not possible with traditional metric platforms.</p> </li> <li> <p><strong>IoT Sensor Metrics Storage</strong>: Collect sensor data from IoT devices via Telegraf and store it in MariaDB using a normalized schema. This approach is cost-effective and integrates well with existing SQL-based systems for real-time or historical analysis.</p> </li> </ol>
Feedback
Thank you for being part of our community! If you have any general feedback or found any bugs on these pages, we welcome and encourage your input. Please submit your feedback in the InfluxDB community Slack.
Powerful Performance, Limitless Scale
Collect, organize, and act on massive volumes of high-velocity data. Any data is more valuable when you think of it as time series data. with InfluxDB, the #1 time series platform built to scale with Telegraf.
See Ways to Get Started
Related Integrations
Related Integrations
HTTP and InfluxDB Integration
The HTTP plugin collects metrics from one or more HTTP(S) endpoints. It supports various authentication methods and configuration options for data formats.
View IntegrationKafka and InfluxDB Integration
This plugin reads messages from Kafka and allows the creation of metrics based on those messages. It supports various configurations including different Kafka settings and message processing options.
View IntegrationKinesis and InfluxDB Integration
The Kinesis plugin allows for reading metrics from AWS Kinesis streams. It supports multiple input data formats and offers checkpointing features with DynamoDB for reliable message processing.
View Integration