Using Prometheus for Network Monitoring with Serverboards

  Visit at GitHub

Serverboards have prometheus integration via the Prometheus Plugin. This blog post helps to configure Serverboards to be able to use Prometheus for graph visualization.

Disclaimer: Serverboards and in particular the Prometheus Plugin is as of this writing still in early development, so not so much features are included. In the future this features will be expanded as required by the community of its users.

Install prometheus and node exporter

To be able to use Prometheus from Serverboards you need to have it already installed in your network. It can be on any server that is accesible via an SSH Server service.

This guide will not focus on installing and configuring your Prometheus installation nor the node exporter. There are nice guides on the internet ( 1, 2, for example).

Install the Prometheus plugin

Serverboards have an easy plugin installation system. It can install any plugin from an accesible git repository. This way any plugin already published on github or gitlab or any other git repository can be added as a plugin. It uses the configured SSH service to access, so if necesary access can be provided even on private repos by using the Serverboards SSH public key, accesible at any SSH access settings dialog.

The one we are going to use is at gitlab, at the link git@gitlab.com:serverboards/serverboards-plugin-prometheus.git.

To access the plugin list we press on our users icon and then on Settings. On the left side there is a Plugins section. Here we see al installed plugins, if they are enabled or not, if are updatable and some other states.

Users

On the top there is a URL area were we can write our plugin url, and press Install. In some seconds we sould see our plugin listed with the others.

Plugins Settings

Prometheus plugin

Create the service

Serverboards is based on Services. To access the Prometheus instance we may access directly from our server or via a SSH server. This second option allows to hav e a very secure connection with servers on other locations out of our DMZ, for example in a cloud server.

If we need to access via a SSH server, we first add the SSH server.

For that we need to go to the Serverboard where we want to add this services, and add the SSH server service.

Add SSH Service

Here we can set the SSH Address as a user@host or use ssh://user@host:port. We can even write something in the address area and use the SSH Options to force set a hostname, a Port, username, ProxyCommand and so on. Also once configured we can access to nice extras as the SSH terminal.

SSH Settings

The we create the Prometheus service. Here we can select to access via our recenly created SSH access, or directly just writing the address.

Add Prometheus Service

Creating the Widgets

Going back to our Dashboard we can add the Prometheus Widget. On the configuration we have to choose from which Prometheus Service we will grab our data, and the iquery formula to show.

To learn more about possible query formulas, I recommend to check the official Prometheus documentation, but this tutorial had the goal to monitor the network usage, so the expression to use would be:

rate(node_network_receive_bytes{job="node"}[1m])
rate(node_network_transmit_bytes{job="node"}[1m])

This gives the bytes by network controller. If more fine tunning is needed, please check the Prometheus documentation.

Prometheus At Serverboards showing the network
usage

Other interesting formulas to use are:

CPU usage across all CPUs:

100 - (avg by (instance) (irate(node_cpu{job="node",mode="idle"}[1m])) * 100)

Final remarks

One final advise. As Serverboards defaults to show data from last 7 days, and we just installed our Prometheus, maybe there will not be many data to show. Try setting the date range from the last five minutes or so to see the latest data flow.