On this tutorial, we will focus on how to Install Grafana with Prometheus on RHEL 9 / CentOS Stream 9. Grafana is open-source monitoring software that enables you to examine, query, visualize, and receive alerts on your metrics, logs, and traces regardless of where they are kept. It is a web application used for data visualization, including creating graphs, dashboards, and charts of data from many data sources. Dashboards can be made and distributed to your team. There are two main categories of data visualized in Grafana; Metrics like CPU Load, memory usage, and temperature, and Logs including timestamps.

Features of Grafana

  • Grafana has a plethora of visualization to help understands data.
  • Define alerts to be notified seamlessly including PagerDuty, SMS, email, VictorOps, OpsGenie, or Slack.
  • Supports different databases in the same dashboard.
  • Easily extensible with hundreds of dashboards on the official Library.
  • Improves collaboration by empowering users on a team while they share dashboards.
  • Distinctive user interface with individual panels from different data sources.

Prometheus is also a monitoring software that keeps track of information of several different systems and components like CPU, Memory, Disk, and Network utilization. Prometheus stores data in a database and can be used to collect server or application metrics. Grafana supports querying Prometheus as one of its data sources to visualize the information in a friendly dashboard.

Making observability, data visualization, and analytics simpler and more accessible for everyone is a major goal for Grafana The latest Grafana 9 has new and improved features that include;

  • A new UI query builder that allows anyone to compose and learn how Prometheus queries work.
  • A new query builder that will help you write and understand Loki queries without knowing any of the syntaxes.
  • A new modern panel that is using the new panel option architecture.
  • Advanced security and authentication features.
  • Grafana Alerting is now on by default in Grafana 9.
  • Envelope encryption to encrypt secrets in the database is enabled by default.
  • Expand the navigation bar for a better overview of Grafana’s features and installed integrations.

This guide will show you how to install Grafana 9 with Prometheus on RHEL 9 / CentOS Stream 9. Check below for what you need to do before you proceed with the installation;

Prometheus should be installed on your system, and if not use the guide below:

Install Grafana 9 on RHEL 9 / CentOS Stream 9

The first step is to install Prometheus, use the article highlighted above to do so. Once done, proceed to add the Grafana Repository to your system.

$ sudo vi /etc/yum.repos.d/grafana.repo
[grafana]
name=grafana
baseurl=https://packages.grafana.com/oss/rpm
repo_gpgcheck=1
enabled=1
gpgcheck=1
gpgkey=https://packages.grafana.com/gpg.key
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt

Save and exit the file, to do so, use :x . Proceed to update the added repository using the command;

sudo dnf update

Update Policy to SHA1 by utilizing the command;

sudo update-crypto-policies --set DEFAULT:SHA1

Once the update is done, go ahead and reboot your system using the command;

sudo reboot

Then install Grafana with the following command;

sudo dnf install grafana

To confirm installation, check the version.

$ grafana-server -v
Version 9.1.7 (commit: 0cbb79298d, branch: HEAD)

Configure firewall settings to allow Grafana service.

sudo firewall-cmd --add-port=3000/tcp --permanent
sudo firewall-cmd --reload

Start and enable the Grafana service.

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

Check for the service status.

$ sudo systemctl status grafana-server

 grafana-server.service - Grafana instance
     Loaded: loaded (/usr/lib/systemd/system/grafana-server.service; enabled; >
     Active: active (running) since Mon 2022-08-22 17:55:47 EAT; 10s ago
       Docs: http://docs.grafana.org
   Main PID: 3815 (grafana-server)
      Tasks: 7 (limit: 48771)
     Memory: 38.7M
        CPU: 595ms
     CGroup: /system.slice/grafana-server.service
             └─3815 /usr/sbin/grafana-server --config=/etc/grafana/grafana.ini

Use Grafana with Prometheus on RHEL 9 |CentOS 9

To use Grafana, Go to your browser on http://localhost:3000. The default login is “admin” / “admin”.

Then a prompt to change your password shows up(recommended).

Then you will be redirected to the Grafana Dashboard.

Creating a Prometheus data source

Click on the settings icon with the configuration menu.

Then click on Data Sources to open the following page. Click on “Add data source”.

Select “Prometheus” as the type of data source you want.

Set the appropriate Prometheus server URL (for example, http://localhost:9090/)

You can also adjust other data source settings like authentication details.

Click “Save & Test” to save the new data source. You should get a successful prompt like the one below.

Creating a Dashboard on Grafana

Grafana maintains a public library of pre-built dashboards that can be downloaded and used with standalone instances of Grafana.We will import a pre-built node exporter dashboard from the public Grafana Dashboards hub. Copy the ID which will be used during the import process. Just like as shown in the image below;

Go to the menu icon and click on import.

Paste the ID that you copied from the webpage. Then click on Load.

The Node Exporter dashboard details appear as shown below. You can change the Folder Name or leave it as ‘General’. Select the Prometheus data source and then Click on Import.

The dashboard appears as shown below

Conclusion

We have gone through the process of installing Grafana 9 with Prometheus on RHEL 9 / CentOS Stream 9. Grafana 9 comes with new visual query builders for both Prometheus and Loki data sources. This assists users in creating, comprehending, and learning how to use the underlying query languages. Grafana has enhanced security and authentication features, a brand-new and powerful heatmap visualization, a more user-friendly navigation menu, and more. Check below for more articles on our end;

1 COMMENT

LEAVE A REPLY

Please enter your comment!
Please enter your name here