How To Install Prometheus Monitoring Tool On Linux

How To Install Prometheus Monitoring Tool On Linux

Prometheus is an open-source monitoring system with a dimensional data model, efficient time-series database and alerting approach. Let’s see, how to install the Prometheus monitoring tool in Linux. so

Check Out: Configure Filebeat For MySQL Database Server In Elasticsearch ELK

we will create a system user for Prometheus and it will run as a non-root user. so

useradd -m -s /bin/false prometheus

grep prometheus /etc/passwd

How To Install Prometheus

Create a directory under these two locations and also change the ownership to Prometheus. so

mkdir /etc/prometheus

mkdir /var/lib/prometheus

chown prometheus /var/lib/prometheus/

prometheus monitoring tool install

Check Out: How To Create Database And User In SQLyog On Windows

I have already downloaded the package and you can also use the below command to get it. so

wget https://github.com/prometheus/prometheus/releases/download/v2.15.2/prometheus-2.15.2.linux-amd64.tar.gz

Once download completed, extract the tarball file.

tar -xvf prometheus-2.15.2.linux-amd64.tar.gz

prometheus monitoring tool

you can see the list directory using tree command.

install prometheus in linux

Check Out: How To Install Portainer Web UI For Docker On Linux

we need to copy Prometheus YAML file to /etc/prometheus/

cp -rfvp prometheus.yml /etc/prometheus/

monitoring tool prometheus

we need to copy these two binary files Prometheus & promtool to /usr/local/bin/

cp -rfvp prometheus promtool /usr/local/bin/

Allow the port 9090 in the firewall.

firewall-cmd --permanent --add-port=9090/tcp

firewall-cmd –reload

Check Out: How To Display Timestamp In History Command On Linux

To manage Prometheus, we need to create a service.

vim /etc/systemd/system/prometheus.service

[Unit]

Description=Prometheus Time Series Collection and Processing Server

Wants=network-online.target

After=network-online.target

[Service]

User=prometheus

Restart=on-failure

Group=prometheus

Type=simple

## change the these lines where you have kept the download setup

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

run the below command to take effect,

systemctl daemon-reload

Check Out: Unable To lock Administration Directory (/var/lib/dpkg/) On Ubuntu 18.04

Now start the Prometheus service.

systemctl start prometheus && systemctl enable prometheus

netstat -tnlp

you have to access Prometheus using your serverip:9090

Click on status then targets

you will see the information about your machine.

You’re done

About Helios Smith

Author is a avid reader

Latest Posts
Follow Us
Get the latest news delivered daily!