Table of Contents
This tip is about the how to install Prometheus in Debian 11. So read this free guide, How to install Prometheus in Debian 11 step by step. If you have query related to same article you may contact us.
How to install Prometheus in Debian 11 – Guide
Prometheus is open source software for monitoring computers, software and services. It can read various metrics from operating systems, software and services in real time and alert users to various events based on these metrics. In this article, I will talk about different parts of Prometheus and show you how to install it on Ubuntu 20.04 LTS. I’ll also show you the basics. Prometheus is an open source event monitoring and alerting system. Prometheus collects and stores your metrics as time series data; H. Metric information is stored with the timestamp it was recorded, along with optional key-value pairs, so-called labels.
Prometheus is an open source system and service monitoring and alerting tool used to log services in real time and collect metrics in a time series database. It is written in Go and licensed under the Apache 2 license, which was originally developed by SoundCloud. Don’t forget to replace IP_Address and Port_Number with your server’s real IP address and SSH port number. You should also replace “root” with the username of the administrator account, if necessary. The default configuration of Prometheus only exports metrics about itself. However, you can extend it by installing exporters and other programs. It supports a multidimensional data model, multiple charts and dashboard modes.
Install Prometheus
Before starting, it is recommended to create a dedicated user and group for Prometheus. You can create it using the following command:
Then download the latest version of Prometheus by running the following command:
Once Prometheus is downloaded, you can see the downloaded file using the following command:
You should see the following output:
Then extract the downloaded file using the following command:
Then change directory to the extracted directory with the following command:
Then create some necessary directories using the following command:
Then copy the necessary configuration files and tools with the following commands:
Once finished, you can proceed to the next step.
Create a Systemd service file for Prometheus
Next, you will need to create a systemd service file to manage the Prometheus service. You can create it by running the following command:
Save and close the file and set proper ownership and permission to the Prometheus configuration directory:
Then reload the systemd daemon to apply the changes:
Then start the Prometheus service and enable it to start on system reboot using the following command:
You can check the status of Prometheus with the following command:
By default, Prometheus listens on port 9090. You can verify this using the following command:
Configure Nginx as a reverse proxy for Prometheus
Next, it is recommended to install and configure Nginx as a reverse proxy for Prometheus. First, install the Nginx web server package using the following command:
Once Nginx is installed, create an Nginx virtual host configuration file with the following command:
Save and close the file and check Nginx for any syntax errors with the following command:
If everything is ok, you will get the following output:
Finally, restart the Nginx service to apply the changes:
You can also check the status of the Nginx service using the following command:
Access the Prometheus dashboard
Now open your web browser and access the Prometheus dashboard using the URL http://prometheus.example.com. You should see the following page:
Install and configure node_exporter
node_exporter is an exporter that will monitor and get metrics from the Prometheus server. First, download the latest version of node_exporter using the following command:
When the download is complete, extract the downloaded file with the following command:
Then move the extracted directory to the /etc/prometheus/ directory:
Then set the proper property with the following command:
Then create a systemd service file to manage the node_exporter service:
Save and close the file and reload the systemd daemon to apply the changes:
Then start the node_exporter service and enable it to start on system reboot:
You can check the status of node_exporter with the following command:
By default, node_exporter listens on port 9100. You can verify this with the following command:
Add node_exporter to Prometheus Server
Next, you will need to add the node_exporter to the Prometheus configuration file. You can do this by editing the default Prometheus configuration file:
In the ‘scrape_config’ line, add the new job_name node_exporter by adding the following lines.
Save and close the file and restart the Prometheus service to apply the changes:
Final note
I hope you like the guide How to install Prometheus in Debian 11. In case if you have any query regards this article you may ask us. Also, please share your love by sharing this article with your friends.