We earn commission when you buy through affiliate links.

This does not influence our reviews or recommendations.Learn more.

In this tutorial, I will talk about Prometheus and Grafana.

Article image

Introduction

Grafanais a leading time-series, an open-source platform for visualization and monitoring.

you’ve got the option to create amazing dashboards in Grafana to visualize and monitor the metrics.

Prometheusis anopen-source time-seriesmonitoring system for machine-centric and highly dynamic service-oriented architectures.

prometheus web ui - geekflare

It can literally monitor everything.

It integrates with Grafana very smoothly as Grafana also offers Prometheus as one of its data sources.

If you are a newbie, I would suggest checking out anintroduction to Prometheus and Grafana article.

prometheus target - geekflare

Let me show you how to install them on CentOS.

You should have at least 2GB of RAM.

you’re free to get a cloud server fromDigitalOceanto try out.

grafana web ui - geekflare

Check theofficial release pageto obtain latest release.

Extract the package which you downloaded.

Step 2: Configure Prometheus

Create a new user Prometheus using the below command.

grafana home - geekflare

Give all the Prometheus file ownership to Prometheus user.

Make all the files executable in the path mentioned.

It is time to configure Prometheus as a service inside the systemd.

prometheus targets - geekflare

Create a fileprometheus.serviceand put the lines mentioned below in the file and save it.

Step 3: Start Prometheus

Usingsystemctl, reload the systemd system, and start the Prometheus service.

Its status should show the service is running if you have followed all the steps correctly.

add data source - geekflare

Go toStatus»Targetsto see what all and where Prometheus is currently running.

Create a filegrafana.repoinside/etc/yum.repos.d/and add the lines mentioned below.

Step 3: Start Grafana

Start grafana server and check the status if its running or not.

data source prometheus - geekflare

This is how the Home of Grafana looks like.

Installing Node Exporter

node_exporteris an official package that should be installed on Linux servers to be monitored.

It exposes multiple hardware and OS metrics, which will be pulled by Prometheus and eventually visualized on Grafana.

grafana import - geekflare

Step 1: Download Node Exporter

Use wget to download the node exporter package on your server.

Check out therelease pageto get the latest version

Extract the downloaded file.

Create a filenode_exporter.serviceand put the lines mentioned below in the file and save it.

grafana import node exporter - geekflare

Open a new tab in the terminal and edit the file as mentioned below.

you could change this to the actual Linux servers IP.

Port 9100 is the default port of node_exporter.

grafana monitor - geekflare

Integrating Prometheus to Grafana

Now that Grafana and Prometheus are installed.

let us use them for monitoring servers.

Grafana is successfully connected to Prometheus.

node exporter dashboard - geekflare

Its time to create a dashboard.

Conclusion

I hope this gives you an idea of how to set up Grafana and Prometheus for server metrics.

There are more ways to monitor servers, such as tryingserver monitoring software.

network traffic ui - geekflare

If you are interested in learning Grafana, then I would suggest checking out thisUdemy hands-on course.