How to Setup Grafana With Prometheus

logos 1

In this tutorial, we will walk you through the basics of Grafana, and Setup Grafana with Prometheus, and also show you how to set up a basic monitoring system.

What is Grafana?

Grafana is a powerful visual analytics platform that helps you monitor your infrastructure and data. It offers a wide range of features for data exploration, data analysis, and alerting.

What is Prometheus?

Prometheus is an open-source monitoring system that collects system metrics and alerts on events. It is written in Go and can be used on a variety of platforms.

It is a powerful tool that can be used to monitor a variety of systems, including servers, applications, and networks.

Benefits of using Grafana and Prometheus

Prometheus and Grafana are two popular open-source tools that can be used together to monitor a wide variety of systems. Here are some benefits of using them together.

  • Easy to set up and use: Both Prometheus and Grafana are easy to set up and use. This makes it possible to get started quickly and get valuable insights into your system with minimal effort.
  • Wide compatibility: Prometheus is compatible with a wide range of systems and Grafana supports a variety of data sources, making it easy to find a solution that fits your needs.
  • Rich data visualization: Grafana provides a rich set of data

Install and Configure Grafana on Linux Systems

Step 1: To install Grafana on Debian-based / RPM systems, run the following commands

Debian Based systems

sudo apt update && sudo apt-get install -y adduser libfontconfig1
sudo dpkg -i grafana_9.0.5_amd64.deb

RPM Based systems

To install Grafana on RPM-based systems, You can use the YUM repository by adding a new yum repo

cat > /etc/yum.repos.d/grafana.repo <<EOF

Update the Repos and install Grafana

sudo dnf update && sudo dnf install grafana -y

Step 2: Start and Enable Grafana Service

sudo systemctl daemon-reload
sudo systemctl start grafana-server
sudo systemctl enable grafana-server

Step 3: Access Grafana

After starting the Grafana services, Open the browser and log in to the Grafana UI by typing the server URL followed by Port 3000

Grafana Login Page

Install Node Exporter

The Prometheus Node exporter allows administrators to export data from a Prometheus server to a Node.js application. The Node exporter also allows administrators to export data to a variety of formats, including JSON, CSV, and Grafana.

Step 1: Download the Node Exporter file


Step 2: Untar the file and move the binaries to /usr/local/bin and create a node exporter user

tar -xvf node_exporter-1.4.0-rc.0.linux-amd64.tar.gz && mv node_exporter-1.4.0-rc.0.linux-amd64/node_exporter /usr/local/bin
useradd --no-create-home --shell /bin/false node_exporter

Step 3: Create a node_exporter service

cat > /etc/systemd/system/node_exporter.service <<EOF
Description=Node Exporter



Step 4: Reload the system daemon and start the node exporter service

sudo systemctl daemon-reload
sudo systemctl start node_exporter
sudo systemctl enable node_exporter

Step 5: Add the Node exporter server to the Prometheus server

Now node exporter is installed and the respective hostname/IP needs to be added to the Prometheus YAML file.

  - job_name: "node_exporter"

      - targets: [""]
Node exporter

Add Prometheus Source on Grafana Dashboard

Once we logged into Grafana, we need to add the data source For adding the data source click on the “Data Sources” box

Add Data source in Grafana

Once loaded multiple data sources will be there Prometheus, Graphite, InfluxDB and etc…, Select Prometheus as Data Sources

Prometheus Data source

Type the Prometheus Server address in the URL Field and click on Save & Test, Once it is completed you will get a notification about whether the Data Source is working / not working

Grafana Datasource check

The next step is to create a dashboard or import it from the Grafana lab’s official download page.

Once the dashboard Import is completed, Grafana will start fetching the metrics from the Prometheus servers and visualize the information.

That’s all this tutorial.

Grafana Data


From this tutorial, you have learned how to Setup Grafana with Prometheus on Ubuntu, Debian, Linux Mint, AlmaLinux, Rocky Linux, and Fedora

Do let us know your comments and feedback in the comments section below.

If my articles on TipsonUNIX have helped you, kindly consider buying me a coffee as a token of appreciation.


Thank You for your support!!

Leave a Comment