Streaming IoT data with MQTT and Mosquitto
Now that we’ve established the basis for communicating real-time data with Telegraf and Grafana, we can move on to integrate that knowledge with the world of the Internet of Things (IoT). The IoT makes it possible for virtually any properly equipped device to transmit its telemetry data over the internet using lightweight messaging protocols. One of the most common of these protocols is called MQTT, an abbreviation for Message Queuing Telemetry Transport. MQTT, now on version 5, is simple, open, and requires only a small software footprint.
However, unlike REST calls over the HTTP protocol, which tend to connect directly from client to server and back, MQTT requires an intermediary broker to maintain the message queue and facilitate transport between message producers and message consumers. To simulate an IoT message producer, we will be developing a simple Python script to create messages, and we will rely on Telegraf to consume...