Post

Prometheus - Grafana

01

What is Grafana?

Grafana is a data visualization and analytics tool that integrates with Prometheus to create rich, interactive dashboards and visualizations.
Grafana is a great companion for Prometheus as it’s able to take the data that Prometheus has collected and present it in a visually appealing dashboards.


Setting up Grafana


First, add Grafana repository to our linux server

1
2
3
4
sudo apt-get install -y apt-transport-https
sudo apt-get install -y software-properties-common wget
wget -q -O - https://packages.grafana.com/gpg.key | sudo apt-key add -
echo "deb https://packages.grafana.com/oss/deb stable main" | sudo tee -a /etc/apt/sources.list.d/grafana.list


Now we can begin the installation

1
2
sudo apt-get update
sudo apt-get install grafana -y


After that, we can just start the Grafana service

1
2
sudo systemctl start grafana-server
sudo systemctl enable grafana-server


Use this commmand to check wether the service is up and running

1
systemctl status grafana-server
1
2
3
4
5
6
7
8
9
10
● grafana-server.service - Grafana instance
     Loaded: loaded (/lib/systemd/system/grafana-server.service; disabled; vendor preset: enabled)
     Active: active (running) since Mon 2023-07-17 05:32:36 UTC; 6h ago
       Docs: http://docs.grafana.org
   Main PID: 3984 (grafana)
      Tasks: 15 (limit: 9386)
     Memory: 77.2M
        CPU: 51.622s
     CGroup: /system.slice/grafana-server.service
             └─3984 /usr/share/grafana/bin/grafana server --config=/etc/grafana/grafana.ini --pidfile=/run/grafana/grafana-server.pid


Now we can access the web on http://198.18.0.120:3000

02



Connecting to Prometheus


To connect it with Prometheus, we need to add Prometheus as a Data Source on Grafana. To do that, go to Administration > Data Sources > Prometheus, and then add the url to the Prometheus server.

03


After that, you can start creating cool dashboards utilizing data scraped by Prometheus

04



Using Dashboard Templates


Creating your own dashboard is pretty cool, but its confusing and tideous, a better way to do that is utilizing pre-exisiting dashboard that you can easily import. Here you can find a lot of cool Grafana Dashboards

05


Here we’ll use the Node Exporter Full. This dashboard will show metrics scraped by Node Exporter module. Select Copy ID to Clipboard

06


After that paste the ID that has been copied

07


And now we have a clean dashboard for our nodes.

08



Another dashboard example, this time its for SNMP Exporter called SNMP Device Summary. This is how it looks like

09


Pertty cool!

This post is licensed under CC BY 4.0 by the author.