We're here to assist with any of your needs, don't hestitate to reach out.
Prometheus is an open-source monitoring and alerting tool, designed for collecting and processing metrics from various systems. It provides a flexible query language, powerful visualizations, and alerting capabilities. Prometheus follows a pull-based model, where it regularly scrapes targets to collect metrics.
Before installing Prometheus, it is recommended to update your CentOS 8 system to ensure you have the latest packages and security updates.
sudo dnf update -y
Download the latest stable version of Prometheus from the official website.
wget https://github.com/prometheus/prometheus/releases/download/v2.29.0/prometheus-2.29.0.linux-amd64.tar.gz
Extract the downloaded Prometheus tarball.
tar xvfz prometheus-2.29.0.linux-amd64.tar.gz
Create and edit the prometheus.yml
configuration file.
cd prometheus-2.29.0.linux-amd64
nano prometheus.yml
Add the necessary configurations for your targets, such as scraping endpoints, jobs, and metric paths.
global:
scrape_interval: 15s
scrape_configs:
- job_name: 'node'
static_configs:
- targets: ['localhost:9100']
Start Prometheus using the provided binary.
./prometheus --config.file=prometheus.yml
Prometheus will start and begin scraping the configured targets for metrics.
Access the Prometheus Web UI by opening a web browser and navigating to http://localhost:9090
.
From the Web UI, you can explore the collected metrics, run queries, create visualizations, and set up alerting rules.
To run Prometheus as a service, you can create a systemd unit file.
sudo nano /etc/systemd/system/prometheus.service
Add the following content to the unit file:
[Unit]
Description=Prometheus
Wants=network-online.target
After=network-online.target
[Service]
Type=simple
ExecStart=/path/to/prometheus --config.file=/path/to/prometheus.yml
[Install]
WantedBy=default.target
Replace /path/to/prometheus
and /path/to/prometheus.yml
with the actual paths to your Prometheus binary and configuration file.
Save and close the file. Then, enable and start the Prometheus service:
sudo systemctl enable --now prometheus
Now Prometheus will automatically start on system boot and run as a background service.
Congratulations! You have successfully installed Prometheus on CentOS 8. You can now use Prometheus to monitor and collect metrics from your systems and applications.
What our customers say about us
Create your free account today.