Grafana setup

Grafana helps to visualize the Prometheus metrics in the form of graphs and charts.

This section describes how to install Grafana in an LPAR and connect the existing Prometheus to it.

Required components

Architecture

The figure shows an installed instance of Grafana and its connection with Prometheus on an LPAR.

Figure 1. Grafana architecture
Grafana Architecture

1. The Grafana package comes with the RHEL repository and it can be installed by running the following command:

 # dnf install grafana

Grafana Installation

2. After the installation has completed, make sure the Grafana service is up and running:

 # systemctl status grafana-server.service

Output:

 grafana-server.service - Grafana instance
    Loaded: loaded (/usr/lib/systemd/system/grafana-server.service; enabled; vendor preset: disabled)
    Active: active (running) since Tue 2022-07-12 16:09:52 CEST; 2 days ago
      Docs: http://docs.grafana.org
  Main PID: 2922838 (grafana-server)
     Tasks: 55 (limit: 126455)
    Memory: 458.7M

3. The default port for Grafana is 3000. Modify the firewall rules to allow access to Grafana from any local workstation:

 # firewall-cmd --permanent --add-rich-rule 'rule family="ipv4"  source address="192.168.122.0/24" port protocol="tcp" port="3000" accept'
 success
 firewall-cmd --add-port=3000/tcp --permanent
 # firewall-cmd --reload
 success

4. Log in to the Grafana dashboard at http://192.168.122.0:3000 using the default username and password.


Grafana Login

5. Select Configuration > Data Sources, then click Add data source.


Grafana Adding Prometheus Data Source

6. Select Prometheus database.


Grafana Adding Prometheus Data Source

7. Update the Prometheus login url http://192.168.122.0:9090, then click Save & Test to test the connection. If the connection is working correctly, the message Data source is working is displayed.


Grafana Adding Prometheus URL

8. Now Prometheus is configured and you can start creating your desired metrics.

The next sections guide you through how to create sample monitoring graphs: