Reader small image

You're reading from  Building IoT Visualizations using Grafana

Product typeBook
Published inJul 2022
PublisherPackt
ISBN-139781803236124
Edition1st Edition
Right arrow
Author (1)
Rodrigo Juan Hernández
Rodrigo Juan Hernández
author image
Rodrigo Juan Hernández

Rodrigo Juan Hernández is an electronic engineer passionate about IoT even before it existed. He has been working on tech for more than 18 years until now. For several years he has been focusing on the IoT ecosystem. He is currently giving consultation about IoT systems to clients around the world. He also produces content online about IoT and related subjects and the content is available on his blog, Youtube channel, and social networks - mainly LinkedIn. He also writes for companies that need good quality content about their products and services. His main objective nowadays is helping others to understand and implement IoT solutions.
Read more about Rodrigo Juan Hernández

Right arrow

Chapter 14: Integrations for Grafana Cloud

In this chapter, you will learn how to use the Grafana integrations in the Grafana Cloud service.

The integrations allow you to gather metrics from hosts and systems and build dashboards rapidly and easily. You just have to enable them in the Grafana Cloud service and deploy a Grafana agent in the host where you have the system you want to monitor.

In this chapter, you will learn the following:

  • What is the Grafana Agent?
  • Using the Linux Node integration.
  • Using the Home Assistant integration.
  • Using the RabbitMQ integration.

When you finish this chapter, you will be able to install, configure, and use these integrations. Also, you will have the ability to use any other integration.

Technical requirements

To get the most out of this chapter, you should have the following:

  • A Grafana Cloud service account – it’s free.
  • A Linux node – here, we use a Raspberry Pi 3.
  • A Home Assistant instance running on a Linux machine.

First, let’s see what the Grafana Agent is.

What is the Grafana Agent?

The Grafana Agent is a piece of software – based on remote_write from Prometheus – that you can run in the host where you have your application. This software gathers metrics from your host and its services and sends them to the Grafana Cloud service.

Important Note

To learn more about the remote_write functionality in Prometheus, please go to https://prometheus.io/docs/practices/remote_write/.

Unlike Prometheus, the Grafana Agent just implements remote_write, leaving all other Prometheus features aside. In particular, the Grafana Agent delivers remote_write, services discovery, and relabeling rules. This approach saves a lot of memory. Typically, you can expect a saving of 40 percent compared with the Prometheus alternative.

On the other hand, the Grafana Cloud service brings you ready-to-use dashboards, where you can view all the metrics exported by the Grafana Agent.

So, the Grafana Agent makes it easy to collect and display...

Using the Linux Node integration

The Linux Node integration offers the typical system metrics that you may use to monitor any Linux host. This can include Internet of Things (IoT) end devices, IoT gateways, and servers.

To use this integration, you need the following:

  • A Grafana Cloud service account
  • A Linux node
  • Access to the Linux console

To install the integration in the cloud and your host, follow these steps:

  1. Log in to your Grafana Cloud account.
  2. Click on Integrations and Connections on the left menu bar. This will lead you to the integration page, where you can search for and select Linux node integration. You can see the page in Figure 14.1:

Figure 14.1 – The Integrations and Connections page

  1. To install this integration in your instance of Grafana Cloud, just click on the corresponding box. This will install the integration automatically.
  2. Then, click again on the box to open the Configuration...

Using the Home Assistant integration

Home Assistant is an open source home automation system. You can run it locally on your server or even on a Raspberry Pi. It’s a very mature project, which integrates more than 1,900 devices and services.

You can find all the documentation and the project files on its website at https://www.home-assistant.io/.

Although Home Assistant was born as a home automation system, you can also use it as part of an IoT system. You can, for example, integrate it with Grafana, InfluxDB, MQTT, and many other services and applications.

The Grafana Cloud service integration lets you monitor your Home Assistant instance, getting metrics from its services.

Important Note

To be able to scrap the Home Assistant instance from the Grafana Agent, you have to use the Home Assistant Core version. You can see how to install it at https://www.home-assistant.io/installation/linux#install-home-assistant-core.

Let’s see how to install and configure...

Using the RabbitMQ integration

RabittMQ is an open source message broker. You can deploy it on a single server or in a cluster, either in the cloud or locally.

You can visit the project website at https://www.rabbitmq.com/.

It supports a wide range of operating systems, such as Linux, Berkeley Software Distribution (BSD), UNIX, Windows, and macOS. You can find installation documentation at the following link: https://www.rabbitmq.com/download.html.

There are a lot of libraries in different languages that you can use for connecting to RabbitMQ. You can take a look at them at https://www.rabbitmq.com/devtools.html.

RabbitMQ supports a wide variety of protocols. It implements natively Advanced Message Queuing Protocol (AMQP) 0-9-1 and supports STOMP, MQTT, AMQP 1.0, HTTP, and WebSockets by using plugins.

As you can see, RabbitMQ is a versatile message broker and is very useful for any IoT system architecture.

Now that you have met RabbitMQ, let’s see how you can...

Summary

In this chapter, you have learned how to use Grafana Cloud integrations. These integrations let you build complex Grafana dashboards in a matter of minutes.

The metric data is sent from the hosts using the Grafana Agent software. This software is built on the Prometheus remote_write functionality. The Grafana Agent comes with preconfigured parameters for scraping relevant data from the host.

On the other side, the integration deploys ready-to-use Grafana dashboards, showing all the data collected by the Grafana Agent.

As you have seen, it’s pretty easy to build specific application dashboards using the Grafana Cloud integrations.

In this chapter, you have seen how to implement the integrations for Linux Node, Home Assistant, and RabbitMQ. You can apply similar procedures to use any other integration.

You have reached the last chapter of this book. I hope you have enjoyed it and thank you very much for reading it.

Why subscribe?

  • Spend less time learning and more time coding with practical eBooks and Videos from over 4,000 industry professionals
  • Improve your learning with Skill Plans built especially for you
  • Get a free eBook or video every month
  • Fully searchable for easy access to vital information
  • Copy and paste, print, and bookmark content

Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at packt.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at customercare@packtpub.com for more details.

At www.packt.com, you can also read a collection of free technical articles, sign up for a range of free newsletters, and receive exclusive discounts and offers on Packt books and eBooks.

lock icon
The rest of the chapter is locked
You have been reading a chapter from
Building IoT Visualizations using Grafana
Published in: Jul 2022Publisher: PacktISBN-13: 9781803236124
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime

Author (1)

author image
Rodrigo Juan Hernández

Rodrigo Juan Hernández is an electronic engineer passionate about IoT even before it existed. He has been working on tech for more than 18 years until now. For several years he has been focusing on the IoT ecosystem. He is currently giving consultation about IoT systems to clients around the world. He also produces content online about IoT and related subjects and the content is available on his blog, Youtube channel, and social networks - mainly LinkedIn. He also writes for companies that need good quality content about their products and services. His main objective nowadays is helping others to understand and implement IoT solutions.
Read more about Rodrigo Juan Hernández