How To Integrate and Visualize Prometheus Metrics In Grafana

Grafana is one of the best open source visualization tools. It can be easily integrated with Prometheus for visualizing all the target metrics.

Visualize Prometheus Metrics In Grafana

In this guide, we will walk you through the following.

  1. Install and configure Grafana
  2. Add Prometheus data source to Grafana
  3. Creating dashboards from Prometheus metrics.
  4. Importing shared Grafana dashboards

To setup Prometheus and Node exporter metrics, please follow the below tutorials.

  1. Setup Prometheus on Linux
  2. Setup Node Exporter

If you are new to Grafana dashboards, you can try this online course – Grafana 5.x and Graphite: Monitoring For DevOps

Install and Configure Grafana


1. Get the latest rpm download link from the official downloads page and download it.

cd /tmp
curl -LO

2. Install the rpm.

sudo yum localinstall grafana-5.2.3-1.x86_64.rpm -y


1. Download the debian package.

curl -LO

2. Install the packages

sudo apt-get install -y adduser libfontconfig
sudo dpkg -i grafana_5.1.4_amd64.deb

Configure Grafana

1. Start and enable the grafana server.

sudo systemctl start grafana-server
sudo systemctl enable grafana-server

2. Access grafana UI on port 3000.


The default username and password is admin. You will be prompted to change the default passsord.

Add Prometheus Source To Grafana

Note: Make sure Prometheus endpoint is accessible from Grafana server.

1. Click the “add source” option from the Grafana homepage.

prometheus grafana add source

2. Add the source name, Prometheus endpoint details and save it.

prometheus grafana source

Create Dashboards From Prometheus Source

1. Select the create dashboard option as shown below.

prometheus grafana create dashboard

2. Select the graph type. You can select the type based on the type of visualization and dashboard you need.

prometheus graph selection

3. Select the edit option from the panel top.

grafana edit panel

4. Select the Prometheus data source and enter the Prometheus expression that has to be graphed under the metrics tab. You can preview the graph using the preview button. Under the general tab, you can assign a name for the dashboard. Save the dashboard after preview.

In the following example, we have given the expression for calculating CPU seconds every minute.

prometheus dashboard source and preview

You can find all the saved dashboards under the home option.

grafana saved dashbaords

grafana dashbaords

Also, you can organize your dashboards under different folders based on your needs.

grafana create folders

Importing Predefined Grafana Dashboard Templates

You can import predefined templates to your Grafana server.

You can find all the shared community dashboards from Grafana Shared Templates

For demo purpose, we will use this template.

You can import a shared dashboard using the key or the JSON file as shown below.

grafana shared dashboard

1. Select the import option as shown below.

grafana import

2. Following are the supported import options. You can add the dashboard ID you get from grafana website, upload the json or paste the json in the text box.

3. Add a template name, Prometheus source, destination dashboard folder and click import.

prometheus grafana import options

Leave a Reply

Your email address will not be published. Required fields are marked *

You May Also Like