Enhanced IoT Dashboards with Golioth, InfluxDB, and Grafana

We co-hosted a webinar with InfluxDB demonstrating how Golioth Pipelines make it simple to stream data from a microcontroller with environmental sensors directly into a production InfluxDB database. Using the example of a greenhouse monitor, we showed how to collect temperature and humidity data from sensors, stream it into InfluxDB, and then visualize and set up alerts in Grafana. With Golioth’s Pipelines, what used to be a complex, multi-month project can now be implemented with just a few lines of YAML configuration. Learn more about Pipelines in our docs or check out the Thingy:91 prebuilt binary we used in the webinar to get started immediately.

Streaming Data from Golioth to InfluxDB

Golioth Pipelines make it straightforward to send data from your IoT devices to InfluxDB. To get started, you can use this pipeline example for InfluxDB with CBOR.

filter:
  path: "*"
  content_type: application/cbor
steps:
  - name: step-0
    transformer:
      type: cbor-to-json
      version: v1
    destination:
      type: influxdb
      version: v1
      parameters:
        url: https://us-east-1-1.aws.cloud2.influxdata.com
        token: $INFLUXDB_TOKEN
        bucket: device_data
        measurement: sensor

You’ll need to enter your InfluxDB URL, along with the url of your InfluxDB instance and API key in the YAML configuration.

This setup allows you to instantly stream your device data securely and efficiently into InfluxDB.

Visualizing IoT Data in Grafana

After streaming data into InfluxDB, the next step is to visualize and act on it. Here’s how we set it up in the webinar:

  1. Connect Grafana to InfluxDB:
    • Open Grafana and navigate to Configuration > Data Sources.
    • Add a new data source and select InfluxDB.
    • Choose “Flux” as your query language.
    • Enter your InfluxDB instance URL, organization, bucket, and authentication token details.
    • Save and test your new data source
  2. Create Charts with Flux:
    • Add a new panel in Grafana and use Flux to fetch your data. For example:
      • Temperature:
        from(bucket: "thingy_data_prod")
          |> range(start: v.timeRangeStart, stop:v.timeRangeStop)
          |> filter(fn: (r) =>
            r._measurement == "sensor" and
            r._field == "weather.tem"
          )
        
      • Humidity:
        from(bucket: "thingy_data_prod")
          |> range(start: v.timeRangeStart, stop:v.timeRangeStop)
          |> filter(fn: (r) =>
            r._measurement == "sensor" and
            r._field == "weather.hum"
          )
        
    • Customize the visualization (e.g., line graphs) to monitor trends in real time.
  3. Set Up Alerts for Humidity:
    • To configure an alert, go to Alerting on the left-hand sidebar in Grafana and select Alert Rules. Then click on Create Alert Rule.
    • In the alert rule setup:
      • Select the same InfluxDB datasource we’d configured before.
      • Define a Flux query (we can use the same one from our chart) that fetches humidity data. For example, use the query shown earlier for humidity.
      • Set a condition to fire the alert when humidity drops below 50%. For example, configure the condition to check if the value of _value in the query output is less than 50.
      • Use the Preview/Test Alert Condition feature to ensure your query and condition behave as expected before saving.
    • After defining the alert rule, configure a contact point in the Contact points tab
    • Finally, create in the Notification policy tab create or use the default notification policy to manage how and when alerts are sent based on severity and timing.

With these steps, not only be able to visualize data but also receive real-time notifications when humidity drops below the desired threshold, ensuring you can respond quickly to critical changes.

Get Started Today

Golioth and InfluxDB make it effortless to manage, visualize, and act on IoT data. With prebuilt binaries like for the Thingy:91 and Grafana’s visualization and alerting tools, you can turn sensor data into actionable insights in no time.

Explore our documentation on Pipelines, or visit our GitHub for prebuilt binaries and open-source reference designs.

You can watch the full webinar at IoT Insights with InfluxDB & Golioth: Real-Time Monitoring Made Simple.

Dylan Swartz
Dylan Swartz
Dylan leads product at Golioth. Having spent over a decade in the trenches as an engineer, he’s no stranger to the complexities of technology. But in recent years, he’s taken the helm of product teams at a variety of hardware/IoT companies. He's not just switching hats; he’s laser-focused on streamlining the intricate dance between hardware and software. And between the lines of product strategy and customer feedback? You might just find him mixing a mean craft cocktail.

Post Comments

No comments yet! Start the discussion at forum.golioth.io

More from this author

Related posts

spot_img

Latest posts

Free Zephyr Training: February 26th, 2025

Golioth is hosting a free Zephyr training on February 26th, 2025. Join us for this three-hour crash course that will get you up to speed with the basics of building IoT applications using Zephyr RTOS.

Golioth Firmware SDK v0.17.0

Yesterday, we released v0.17.0 of the Golioth Firmware SDK. This release introduces support for the Golioth Location service in the SDK. We've also improved...

Using Zephyr SMP with Multiple MCUs

It's easy to see that Golioth makes firmware updates for internet-connected devices a snap. But combine Golioth Cohorts, our improved OTA event log, and interconnectivity tools like SMP, and you end up with a powerful OTA scheme for all of the controllers in a complex system.

Want to stay up to date with the latest news?

We would love to hear from you! Please fill in your details and we will stay in touch. It's that simple!