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
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
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/
I have already downloaded the package and you can also use the below command to get it. so
Once download completed, extract the tarball file.
tar -xvf prometheus-2.15.2.linux-amd64.tar.gz
you can see the list directory using tree command.
we need to copy Prometheus YAML file to /etc/prometheus/
cp -rfvp prometheus.yml /etc/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
To manage Prometheus, we need to create a 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,
Now start the Prometheus service.
systemctl start prometheus && systemctl enable prometheus
you have to access Prometheus using your serverip:9090
Click on status then targets
you will see the information about your machine.