Welcome to our guide on how to Install Prometheus with Node Exporter on RHEL 9/ CentOS Stream 9. Monitoring tools help capture system configuration and resource utilization of IT infrastructure on all devices and endpoints and create a system inventory. Monitoring tools that keep track of software use like How many people are using it? How many requests are coming in? and what is the average response time? With monitoring tools, you will get instant feedback about the software. There are two types of Monitoring stacks in Linux including Monolithic and microservices.
Monolithic architectures include all functionalities of a project existing in a single codebase. All the layers of designing an application including presentation, service, persistence layers, and database are deployed as a single file. They are however simple to deploy, test, deploy, and simple to scale horizontally. The main disadvantage would be that it becomes large with time and is difficult to manage.
Microservices architectures involve an application being developed by more minor services that handle a small portion of the functionality interconnected with each other directly using lightweight protocols like HTTP. Each microservice has its architecture and its own database schema instead of sharing a single database.
There is a list of tools available for monitoring your Linux Machines. They include Zabbix, Prometheus, Logtail, Sematext, DataDog, New Relic, etc.
Prometheus is an open source monitoring tool and time series database used to better understand how applications are behaving including reporting usage on server resource usage and how databases are performing. Prometheus is a service that handles the gathering, storing, and querying of metrics stored in the database. Metrics are measurements taken within an application that changes over time. Prometheus has graphic functionalities that better visualize how metrics change over time with visualization tools such as Grafana. It is available in Darwin, Linux, and Windows operating systems.
Some of its features include
- A multi-dimensional data paradigm that uses key/value pairs and metric names to identify time series data.
- PromQL, a versatile query language that doesn’t rely on distributed storage and may run on a single server node, makes use of this dimensionality.
- A pull model via HTTP is used for time series collection.
- An intermediary gateway is supported for pushing time series.
- Targets are found via static configuration or service discovery.
- Support for a variety of graphing and dashboarding methods.
This guide will take you through the process of installing Prometheus with Node Exporter on RHEL 9/ CentOS Stream 9.
Install Prometheus on RHEL 9/ CentOS Stream 9
Our first task will be to start with installing Prometheus on RHEL 9/ CentOS Stream 9. The following steps will do just that for you.
Step 1. Add Prometheus Repository
Add the Prometheus repository to your system with the following content.
$ sudo vi /etc/yum.repos.d/prometheus-rpm_release.repo [prometheus-rpm_release] name=prometheus-rpm_release baseurl=https://packagecloud.io/prometheus-rpm/release/el/8/$basearch repo_gpgcheck=0 gpgcheck=0 enabled=1 gpgkey=https://packagecloud.io/prometheus-rpm/release/gpgkey sslverify=1 sslcacert=/etc/pki/tls/certs/ca-bundle.crt metadata_expire=300 [prometheus-rpm_release-source] name=prometheus-rpm_release-source baseurl=https://packagecloud.io/prometheus-rpm/release/el/8/SRPMS repo_gpgcheck=0 gpgcheck=0 enabled=1 gpgkey=https://packagecloud.io/prometheus-rpm/release/gpgkey sslverify=1 sslcacert=/etc/pki/tls/certs/ca-bundle.crt metadata_expire=300
Save and exit (😡)the file then update your system packages.
sudo dnf update
Step 2. Install Prometheus on RHEL 9/ CentOS Stream 9
Then install Prometheus with the following command.
sudo dnf install prometheus
To verify the installation. Check the version by running the command shown below;
$ prometheus --version prometheus, version 2.37.0 (branch: HEAD, revision: b41e0750abf5cc18d8233161560731de05199330) build user: [email protected] build date: 20220714-15:13:18 go version: go1.18.4 platform: linux/amd64
Step 3. Adjust Firewall
Adjust the Firewall settings to allow Prometheus service.
sudo firewall-cmd --add-port=9090/tcp --permanent sudo firewall-cmd --reload
Then start and enable the Prometheus service.
sudo systemctl enable --now prometheus.service
Check the status of the service.
$ sudo systemctl status prometheus ● prometheus.service - The Prometheus monitoring system and time series databas> Loaded: loaded (/usr/lib/systemd/system/prometheus.service; enabled; vendo> Active: active (running) since Mon 2022-08-22 15:22:35 EAT; 20s ago Docs: https://prometheus.io Main PID: 6112 (prometheus) Tasks: 7 (limit: 48809) Memory: 19.8M CPU: 64ms CGroup: /system.slice/prometheus.service └─6112 /usr/bin/prometheus --config.file=/etc/prometheus/prometheu
Now that the service is running head to http://localhost:9090 on your browser.
Then go to status >> targets to view metrics.
The Prometheus metrics will be shown below.
Install Node Exporter on RHEL 9/ CentOS Stream 9
Once the Prometheus installation is done, we can then proceed to install Node Exporter on RHEL 9/ CentOS Stream 9. The Prometheus Node Exporter exposes a wide variety of hardware- and kernel-related metrics.
Step 1. Install Node Exporter
Install Node Exporter with the following command
sudo dnf install node_exporter
Step 2. Adjust Firewall
Configure the Firewall to allow Node Exporter service.
sudo firewall-cmd --permanent --add-port=9100/tcp sudo firewall-cmd --reload
Start and enable the service.
sudo systemctl enable --now node_exporter
Check for the Node Exporter service status.
$ sudo systemctl status node_exporter ● node_exporter.service - Prometheus exporter for machine metrics, written in G> Loaded: loaded (/usr/lib/systemd/system/node_exporter.service; enabled; ve> Active: active (running) since Mon 2022-08-22 15:42:56 EAT; 11s ago Docs: https://github.com/prometheus/node_exporter Main PID: 6816 (node_exporter) Tasks: 4 (limit: 48809) Memory: 4.7M CPU: 8ms CGroup: /system.slice/node_exporter.service └─6816 /usr/bin/node_exporter
Step 3. Add Node exporter endpoint configuration
Edit the Prometheus configuration file to add Node exporter endpoint configuration.
$ sudo vi /etc/prometheus/prometheus.yml - job_name: 'node_exporter' static_configs: - targets: ['localhost:9100']
Save and exit the file. Restart the Prometheus service to apply changes.
sudo systemctl restart prometheus
On your browser, go to Status >> Targets to view the metrics of the Node exporter.
Install Blackbox Exporter on RHEL 9/ CentOS Stream 9
The Blackbox exporter allows Blackbox probing of endpoints over HTTP, HTTPS, DNS, TCP, ICMP, and gRPC. Blackbox exporter implements the multi-target exporter pattern.
Step 1. Install Blackbox Exporter
Install the Blackbox exporter with the following command.
sudo dnf install blackbox_exporter
Start and enable the Blackbox service.
sudo systemctl enable --now blackbox_exporter
Check the status of the service.
$ sudo systemctl status blackbox_exporter ● blackbox_exporter.service - Blackbox prober exporter Loaded: loaded (/usr/lib/systemd/system/blackbox_exporter.service; enabled> Active: active (running) since Mon 2022-08-22 16:01:42 EAT; 22s ago Docs: https://github.com/prometheus/blackbox_exporter Main PID: 7097 (blackbox_export) Tasks: 8 (limit: 48809) Memory: 3.1M CPU: 8ms CGroup: /system.slice/blackbox_exporter.service └─7097 /usr/bin/blackbox_exporter --config.file=/etc/prometheus/bl
Step 2. Configure Firewall
Configure the firewall to allow Blackbox exporter service. To do so, run the commands below on your terminal, the output should give you success.
sudo firewall-cmd --permanent --add-port=9115/tcp sudo firewall-cmd --reload
Step 3. Edit Prometheus
Edit the Prometheus configuration file to scrape the exporter itself.
$ sudo vi /etc/prometheus/prometheus.yml - job_name: blackbox static_configs: - targets: ['localhost:9115']
Save and exit the file. Restart the service to apply changes.
sudo systemctl restart prometheus
Go to Status >> targets on your browser. It will show the metrics of the BlackBox itself.
We have installed Prometheus with Node Exporter on RHEL 9/ CentOS Stream 9. Prometheus is effective for capturing any time series that is solely numerical. It works for both monitoring of machines and the monitoring of extremely dynamic service-oriented architectures.
Prometheus is built to be dependable and to be the system you turn to in an emergency to help you identify issues immediately. Every Prometheus server is independent and does not rely on network storage or other external services. Check below for more articles on our site;