Visualize your IoT device metrics on Grafana dashboards using MQTT & Graphite

Visualize IoT device metrics on Grafana dashboards using MQTT & Graphite

Table of Contents

 

undefined  

The proliferation of IoT devices means we have more data about our surroundings than ever before. However, data itself is not useful unless we can take action based on it. In this article, we will show you how you can visualize and monitor your IoT data so that you can effectively act upon them. Note that we use the term IoT data and metrics interchangeably throughout this article.

Get a free trial with MetricFire and start visualizing your data. You can also book a demo and talk to us directly about what MetricFire can do for you.

‍ 

 

Architecture Diagram: MQTT, Graphite & Grafana

To visualize IoT metrics, we need to make our IoT devices send metrics over MQTT protocol to a time-series data storage platform, such as the popular open-source Graphite, which then exposes API endpoints that an open-source dashboarding system, such as Grafana, can retrieve metrics and display. See "Quick Explanation" for a concise summary of MQTT, Graphite, and Grafana.  

‍ 

undefined

‍ 

Quick Explanation:

  • MQTT - MQTT is a lightweight protocol designed specifically for use by IoT devices, which has low battery, and less than ideal network connectivity.
  • Grafana - Grafana, simply put, is a beautiful and powerful dashboard system that can be used to display any data from data sources that Grafana has a plug-in for
  • Graphite - Graphite is a time-series data collector system. Time-series data stored in Graphite can be retrieved from a set of API endpoints.

‍ 

Implementing MQTT, Graphite & Grafana

There are 2 ways to implement these, and which way you choose depends, in some way, upon the kind of person you are. Which one are you?

 

  • "I am a busy person and I don’t want to be woken up at night by a failure in my setup

        Use a hosted service/MetricFire. Setup takes 5 minutes (minimal skill set)

 

  • "I am a real IT man/woman!"

        Set up everything yourself! Setup can take over 10 hours (depending on skillset)

 

Here are the brief steps required for each method: 

Method 1: Use a Hosted Service (5 minutes)

  1. Configure your IoT devices to send data over MQTT protocol to an MQTT broker using a QTT channel
  2. Configure Grafana to retrieve IoT data from Graphite for display

Method 2: Set up Everything Yourself (> 10 hours) 

  1. Set up MQTT broker
  2. Set up Graphite
  3. Set up Grafana
  4. Configure your IoT devices to send data over MQTT protocol to an MQTT broker using an MQTT channel
  5. Configure the MQTT client to subscribe to the MQTT broker 
  6. Configure the MQTT client to send the IoT data over carbon protocols to Graphite 
  7. Configure Grafana to retrieve the IoT data from Graphite for display

  

Method 1: Use a Hosted Service

We will primarily focus on the simpler ‘Use a Hosted Service’ method in this article and leave the gory details for the more complex ‘Setup Everything Yourself’ method for a future article.

Step 1. Sign up for a Hosted MQTT/Graphite/Grafana service, e.g., MetricFire

Step 2. Get the MQTT broker endpoint and channel this from the dashboard

   

undefined

‍ 

Step 3. Configure your IoT devices to send to the MQTT broker endpoint/channel

This depends on your IoT device but, in general, you just need to point your IoT device from the MQTT client (publisher) to the MQTT broker hostname/IP address and MQTT channel from the previous step.

Step 4. On the left-hand menu, click on Grafana, and visualize your dashboard!

 ‍ 

undefined

‍ 

undefined

You might also like other posts...
grafana Jul 24, 2024 · 15 min read

How to use the Grafana Geomap and Worldmap Panels

Discover all you need to know about Grafana Worldmap in this comprehensive post from... Continue Reading

grafana Mar 12, 2024 · 6 min read

The Value Hosted Graphite brings to the Heroku Marketplace

Maximizing Heroku Monitoring Insights with HostedGraphite. Unlocking Heroku's Full Potential Through Real-time Monitoring and... Continue Reading

grafana Nov 27, 2023 · 7 min read

Grafana Tutorial - Annotations

This Grafana tutorial is about annotations. Grafana annotations are for users who want to... Continue Reading

header image

We strive for
99.999% uptime

Because our system is your system.

14-day trial 14-day trial
No Credit Card Required No Credit Card Required