Raspberry Pi Computing: Monitoring with Prometheus and Grafana by Malcolm Maclean

Raspberry Pi Computing: Monitoring with Prometheus and Grafana by Malcolm Maclean

Author:Malcolm Maclean [Malcolm Maclean]
Language: eng
Format: epub, pdf
Publisher: leanpub.com
Published: 2020-01-27T00:00:00+00:00


Then we restart Prometheus to load our new configuration;

sudo systemctl restart prometheus

Now if we return to our Prometheus GUI (http://10.1.1.110:9090/targets) to check which targets we are scraping we can see three targets, including our new node at 10.1.1.160.

New Prometheus Target

Creating a new graph in Grafana

Righto…

We now have our custom exporter reading our values successfully, let’s visualize the results in Grafana!

From the Grafana home page select the Add icon (it’s a ‘+’ sign) from the left hand menu bar and from there select dashboard. Technically this is adding a dashboard, but at this stage we’re just going to implement a single graph.

Add a Graph

The next screen will allow us to start the process by either choosing the type of visualisation (Line graph, gauge, table, list etc) or by simply adding a query. In our case we’re going to take a simple route and select ‘Add Query’. Grafana will use the default visualisation which is the line graph.

Add a Query

Now we are presented with our graph with no data assigned.

Add a Query

By adding a query, we are selecting the data source that will be used to populate the graph. The main source that our Query will be selecting against is already set as the default Prometheus. All that remains for us is to select which metric we want from Prometheus.

We do that by clicking on the ‘Metrics’ drop down which will provide a range of different potential sources. Scroll down the list and we will see ‘water’ which is the first part of our metric name (the domain) that we assigned. Click on that and we can see the two metrics that we set up to record. Select ‘water_depth_metres’.

Select a Metric

That will instantly add the metric data stream with whatever data has been recorded up to that point. Depending on how fast you are, that could be only a few data points or, as you can see from the graph below, there could be a bit more.

Simple Graph

Spectacularly we have our graph of water depth!

At the moment it’s a static graph, so let’s change it to refresh every minute by selecting the drop-down by the refresh symbol in the top right corner and selecting ‘1m’.

Set a refresh rate

Now all we have remaining is to save our masterpiece so that we can load it again as desired. To do this, go to the save icon at the top of the screen and click it.

Save the Graph

The following dialogue will allow us to give our graph a fancy name and then we slick on the ‘Save’ button.

Our first Graph

There it is! It looks slightly unusual stuck on the left hand side of the screen, but that’s because it is a single graph (or panel) in a row that is built for two. As an exercise for the reader, go through the process of adding a second panel by selecting the ‘Add Panel’ icon on the top of the screen.

Add a panel

This time select the water temperature as the metric. You might want to move



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.