Skip to content

TechDirectArchive

Hands-on IT, Cloud, Security & DevOps Insights

  • Home
  • About
  • Advertise With US
  • Contact
  • Reviews
  • Toggle search form
Home » Linux » Install and configure Prometheus for Monitoring on a Linux
  • screenshot 2020 05 05 at 10.26.12
    How to enable or disable User Account Control Windows
  • Featured image 4
    Focus on Tasks: Limit Distraction & Get Things Done on Windows Windows
  • nodee
    How to install Cypress on Windows and perform Automation Windows
  • How to Fix MS SQL Error 832
    MSSQL Server Error 833: Synthesis of Real-World Case Studies Oracle/MSSQL/MySQL
  • drivelock
    How to perform DriveLock quick setup Security | Vulnerability Scans and Assessment
  • How To Remove Takeprize50.life Redirect From Mac unboxhow
    Remove unwanted site redirects or pop-ups from Google Chrome Mac
  • Driver Automation Tool
    Windows Driver Management: Upgrade Driver Automation Tool Windows
  • Oracle momory increase
    What to do after increasing the Memory of Oracle Database Oracle/MSSQL/MySQL

Install and configure Prometheus for Monitoring on a Linux

Posted on 03/04/202206/01/2024 Raphael Gab-Momoh By Raphael Gab-Momoh No Comments on Install and configure Prometheus for Monitoring on a Linux
FEATURE-IMAGE-IMAGE

Prometheus is a lightweight open-source monitoring system with an effective alerting system. In this article, we shall discuss how to “Install and configure Prometheus for Monitoring on a Linux”. Prometheus gathers and saves metrics as time-series data, which means that metric data is kept alongside the timestamp at which it was captured, as well as additional key-value pairs known as labels. Other tutorials can be found here: How to install PostgreSQL on Ubuntu, How to install Apache Tomcat on Ubuntu, How to install Node.js on Ubuntu, How to install PostgreSQL on Ubuntu, how to install Gradle on Ubuntu, and how to install and configure Tripwire on Ubuntu.

More information about Prometheus can be obtained. This tutorial will teach you how to install and configure Prometheus for Monitoring on a Linux Server. Prometheus will be downloaded, installed, and executed.

Prometheus Attributes

The following are some attributes of Prometheus.

1: Time-series data identifiable by metric name and key/value pairs in an inter-data model

2: Uses PromQL for Querying and PromQL  is a versatile query language 

3: That allows you to make use of the dimensionality without relying on distributed storage.

4: Single server nodes are self-contained, and time series are collected using a pull model over HTTP.

5: Pushing time series is possible with the help of an intermediate gateway.

6: Service discovery or static configuration is used to discover targets.

7: Service discovery or static configuration is used to discover targets.

Requirements

Be sure you have sudo access to the Linux server. The server has internet connectivity and can download the Prometheus binaries.

On the server, firewall rules are opened to allow access to Prometheus port 9090.

Please see How to use Prometheus for Monitoring, Install Grafana on Windows and Windows Server, how to Change Visual Studio Code UI language, Performance and Diagnostics in Microsoft Cloud with Azure Monitor, and About AD LDS: Active Directory Lightweight Directory Services.

Steps to Install and Configure Prometheus

To achieve this, we will need to configure Prometheus Binaries.

1: Update the apt package repositories.

sudo apt update

2: Go to the official Prometheus downloads page and get the latest download link for the Linux binary.

DPROMETHEUS-1
download prometheus

3: extract using the tar command, and rename the extracted folder to Prometheus files.

tar -xvf prometheus-2.35.0.linux-amd64.tar.gz
mv prometheus-2.35.0.linux-amd64 prometheus-files
tarx
extract & rename

4: Create a Prometheus user, the necessary directories, and make Prometheus the owner of those directories.

sudo useradd --no-create-home --shell /bin/false prometheus
sudo mkdir /etc/prometheus
sudo mkdir /var/lib/prometheus
sudo chown prometheus:prometheus /etc/prometheus
sudo chown prometheus:prometheus /var/lib/prometheus

5: Change the ownership to the Prometheus user and copy the Prometheus and promtool binaries from the Prometheus files folder to /usr/local/bin.

sudo cp prometheus-files/prometheus /usr/local/bin/
sudo cp prometheus-files/promtool /usr/local/bin/
sudo chown prometheus:prometheus /usr/local/bin/prometheus
sudo chown prometheus:prometheus /usr/local/bin/promtool

Step 6: Transfer the consoles and console libraries folders from Prometheus files to the /etc/prometheus folder and assign the consoles and console libraries directories to the Prometheus user.

Also, see AD LDS and AD DS: Differences between Active Directory Lightweight Directory Services and Active Directory Domain Services, and how to set up Cisco ASA – wipe old configurations.

Configure Prometheus

The /etc/prometheus/Prometheus.yml file should contain all Prometheus configurations.

1: Create the prometheus.yml file.

sudo vi /etc/prometheus/prometheus.yml

2: Copy the following contents to the prometheus.yml file.

global:
  scrape_interval: 10s

scrape_configs:
  - job_name: 'prometheus'
    scrape_interval: 5s
    static_configs:
      - targets: ['localhost:9090']

3: Change the ownership of the file to Prometheus user.

sudo chown prometheus:prometheus /etc/prometheus/prometheus.yml

Setup Prometheus Service File

1: Create a Prometheus service file.

sudo vi /etc/systemd/system/prometheus.service

2: Copy the following content to the file.

[Unit]
Description=Prometheus
Wants=network-online.target
After=network-online.target

[Service]
User=prometheus
Group=prometheus
Type=simple
ExecStart=/usr/local/bin/prometheus \
    --config.file /etc/prometheus/prometheus.yml \
    --storage.tsdb.path /var/lib/prometheus/ \
    --web.console.templates=/etc/prometheus/consoles \
    --web.console.libraries=/etc/prometheus/console_libraries

[Install]
WantedBy=multi-user.target

3: Reload the systemd service to register the Prometheus service and start the Prometheus service.

sudo systemctl daemon-reload
sudo systemctl start prometheus

Check the Prometheus service

sudo systemctl status prometheus
status-1

Access Prometheus Web UI

You may now access the Prometheus UI through the Prometheus server’s 9090 port.

To get the IP address type the command below

ip address show

To navigate to Prometheus UI type the command below and substitute the IP address of your environment

http://<prometheus-ip>:9090/graph

You should be able to view the UI depicted below.

prometheus-ui
Prometheus ui

We have just finished configuring the Prometheus server. To obtain metrics from the source systems, you must first register the target in the Prometheus.yml file.

If you wish to monitor 10 servers, for example, the IP addresses of these servers should be included as targets in the Prometheus setup to scrape the metrics.

The Node Exporter should be installed on the server to capture all system metrics and make them available for Prometheus to scrape.

endpoint
endpoint well configured

Summary

We installed and configured Prometheus on a Ubuntu machine.

And as you can see from the last screenshot, the state says up and this indicates that everything was well configured and working properly. 

I hope you found this article on how to Install and configure Prometheus for Monitoring on a Linux Server useful. If you have any questions, please let me know in the comment session.

Rate this post

Thank you for reading this post. Kindly share it with others.

  • Click to share on X (Opens in new window) X
  • Click to share on Reddit (Opens in new window) Reddit
  • Click to share on LinkedIn (Opens in new window) LinkedIn
  • Click to share on Facebook (Opens in new window) Facebook
  • Click to share on Pinterest (Opens in new window) Pinterest
  • Click to share on Tumblr (Opens in new window) Tumblr
  • Click to share on Telegram (Opens in new window) Telegram
  • Click to share on WhatsApp (Opens in new window) WhatsApp
  • Click to share on Pocket (Opens in new window) Pocket
  • Click to share on Mastodon (Opens in new window) Mastodon
  • Click to share on Bluesky (Opens in new window) Bluesky
  • Click to share on Threads (Opens in new window) Threads
  • Click to share on Nextdoor (Opens in new window) Nextdoor
Linux Tags:Monitoring

Post navigation

Previous Post: How to Install Kubectl on Windows 11
Next Post: How to grant public access to S3 Bucket using Policy

Related Posts

  • maxresdefault
    Linux Directory Hierarchy Linux
  • PlayF
    How to Install PlayonLinux on a Linux System Linux
  • LAMP
    How to setup and configure a Lamp stack on CentOS Linux
  • elasticsearch error feature
    Elasticsearch: How to stop systemd service start operation from timing out Linux
  • Install Packages to Amazon Virtual Machine Using Terraform
    How to Install Packages to Amazon VM using Terraform AWS/Azure/OpenShift
  • feature photo quit vim
    How to Exit Linux Vim or Vi Editor Linux

More Related Articles

maxresdefault Linux Directory Hierarchy Linux
PlayF How to Install PlayonLinux on a Linux System Linux
LAMP How to setup and configure a Lamp stack on CentOS Linux
elasticsearch error feature Elasticsearch: How to stop systemd service start operation from timing out Linux
Install Packages to Amazon Virtual Machine Using Terraform How to Install Packages to Amazon VM using Terraform AWS/Azure/OpenShift
feature photo quit vim How to Exit Linux Vim or Vi Editor Linux

Leave a Reply Cancel reply

You must be logged in to post a comment.

Microsoft MVP

VEEAMLEGEND

vexpert-badge-stars-5

Virtual Background

GoogleNews

Categories

veeaam100

sysadmin top30a

  • screenshot 2020 05 05 at 10.26.12
    How to enable or disable User Account Control Windows
  • Featured image 4
    Focus on Tasks: Limit Distraction & Get Things Done on Windows Windows
  • nodee
    How to install Cypress on Windows and perform Automation Windows
  • How to Fix MS SQL Error 832
    MSSQL Server Error 833: Synthesis of Real-World Case Studies Oracle/MSSQL/MySQL
  • drivelock
    How to perform DriveLock quick setup Security | Vulnerability Scans and Assessment
  • How To Remove Takeprize50.life Redirect From Mac unboxhow
    Remove unwanted site redirects or pop-ups from Google Chrome Mac
  • Driver Automation Tool
    Windows Driver Management: Upgrade Driver Automation Tool Windows
  • Oracle momory increase
    What to do after increasing the Memory of Oracle Database Oracle/MSSQL/MySQL

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 1,839 other subscribers
  • RSS - Posts
  • RSS - Comments
  • About
  • Authors
  • Write for us
  • Advertise with us
  • General Terms and Conditions
  • Privacy policy
  • Feedly
  • Telegram
  • Youtube
  • Facebook
  • Instagram
  • LinkedIn
  • Tumblr
  • Pinterest
  • Twitter
  • mastodon

Tags

AWS Azure Bitlocker Microsoft Windows PowerShell WDS Windows 10 Windows 11 Windows Deployment Services Windows Server 2016

Copyright © 2025 TechDirectArchive

 

Loading Comments...
 

You must be logged in to post a comment.