We're here to assist with any of your needs, don't hestitate to reach out.
Prometheus is an open-source monitoring and alerting toolkit used to collect and analyze metrics from various systems. It is highly configurable and designed for reliability and scalability.
Before installing Prometheus, it's recommended to update the system packages to their latest versions:
sudo apt update
sudo apt upgrade -y
Download the latest Prometheus release from the official website using the following commands:
cd ~
wget https://github.com/prometheus/prometheus/releases/download/v2.29.2/prometheus-2.29.2.linux-amd64.tar.gz
tar xvf prometheus-2.29.2.linux-amd64.tar.gz
Create a configuration file named prometheus.yml:
cd prometheus-2.29.2.linux-amd64
nano prometheus.yml
Enter the following configuration in the prometheus.yml file:
global:
scrape_interval: 15s
scrape_configs:
- job_name: 'prometheus'
static_configs:
- targets: ['localhost:9090']
Start the Prometheus server using the following command:
./prometheus --config.file=prometheus.yml
By default, Prometheus listens on port 9090.
Open a web browser and navigate to http://localhost:9090 to access the Prometheus web interface. From here, you can explore metrics, create graphs, and set up alerts.
If you want Prometheus to run as a service, create a systemd service unit file:
sudo nano /etc/systemd/system/prometheus.service
Enter the following content into the prometheus.service file:
[Unit]
Description=Prometheus
Documentation=https://prometheus.io/docs/introduction/overview/
Wants=network-online.target
After=network-online.target
[Service]
User=prometheus
Group=prometheus
Type=simple
ExecStart=/opt/prometheus/prometheus --config.file=/opt/prometheus/prometheus.yml
[Install]
WantedBy=default.target
Save the file and exit the text editor.
Reload systemd and start the Prometheus service:
sudo systemctl daemon-reload
sudo systemctl start prometheus
sudo systemctl enable prometheus
Now Prometheus will automatically start on system boot.
You have successfully installed Prometheus on Ubuntu 22.04. You can now use Prometheus to monitor and analyze metrics from your systems.
What our customers say about us
Create your free account today.