How to Install Prometheus Server on Ubuntu 20.04 Open Source Monitoring. The best growing companies rely on metrics to monitor and understand the performance of their applications and infrastructure. With that in mind telemetry data and time series databases (TSDB) have exploded in popularity over the past several years. The Prometheus monitoring platform is one of the most popular TSDB available today.
What is Prometheus
Prometheus is one of the prominent free, open source monitoring software hosted by the CNCF (Cloud Native Computing Foundation). It is used as an event monitoring solution and alerting toolkit. It seamlessly integrates with variety of systems via plugins or native integration.
Prometheus was designed to provide monitoring and alerting functionality for cloud-native environments . It is quite a popular monitoring solution used today for Kubernetes Engine, which is also another project managed by CNCF.
It gathers metrics related to your IT infrastructure and applications. These metrics signify the information about an event along with its time, date and a definitive value. These metrics are not like ‘logs’ containing heaps of data. Instead, it comprises only specific information about a wide range of events to help you identify the operating status of your stack.
Target endpoints are found using static configuration or service discovery.
Simplified operation.
Prometheus overview
Prometheus collects metrics from exposed HTTP endpoints. For such application integration, it leverages reams of client libraries in the building stage. For an exposed endpoint, Prometheus scrapes numerical metric and stores it in the form of time series at a local database.
Further, it can produce temporary time series through queries. These time series are identified by their metric name and ‘labels’. PromQL (Prometheus Query Language) generates queries and helps users choose and collect real time series metrics. With PromQL, you can configure alert settings to get notifications at other sources as well such as email, Slack or PagerDuty. In Prometheus web interface, you can visualize this data in the form of tables or graphs. Or, you can even use other display tools like Grafana through API integrations.
Follow this post, we will show you how to install Prometheus server on Ubuntu 20.04.
At this point you will need to create a Prometheus service file to manage the Prometheus service via systemd. You can create it with the following command:
Save and close the file then verify the Nginx configuration file with the following command:
nginx -t
You will get the following output:
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
Next, restart the Nginx service to apply the changes:
systemctl restart nginx
To check the Nginx running status, run the following command:
systemctl status nginx
You will get the following output:
● nginx.service - A high performance web server and a reverse proxy server
Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
Active: active (running) since Wed 2022-04-27 13:37:37 UTC; 5s ago
Docs: man:nginx(8)
Process: 2216 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
Process: 2217 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
Main PID: 2233 (nginx)
Tasks: 3 (limit: 4686)
Memory: 3.5M
CGroup: /system.slice/nginx.service
├─2233 nginx: master process /usr/sbin/nginx -g daemon on; master_process on;
├─2234 nginx: worker process
└─2235 nginx: worker process
Apr 27 13:37:37 ubuntu2004 systemd[1]: Starting A high performance web server and a reverse proxy server...
Apr 27 13:37:37 ubuntu2004 systemd[1]: Started A high performance web server and a reverse proxy server.
Now, open your web browser and access the Prometheus dashboard using the URL http://your-server-ip. You will be asked to authenticate with your username and password as shown below:
Username and Password Authentication
Provide your admin username, password and click on the Sign in button. Once you are logged in, you should see the Prometheus dashboard on the following screen:
Great Job! We have learned how to Install Prometheus Server on Ubuntu 20.04 Open Source Monitoring.
How to Install Prometheus Server on Ubuntu 20.04 Conclusion
In this guide, we explained how to install Prometheus on Debian 11 server. We also explained how to enable the authentication and configure Nginx as a reverse proxy for Prometheus. You can now start monitoring your infrastructure metrics via the Prometheus dashboard.
While monitoring has seen a shift toward tools including Prometheus in the past few years, the dominant solution are Nagios server , Grafana or Zabbix server.
I am a fan of open source technology and have more than 10 years of experience working with Linux and Open Source technologies. I am one of the Linux technical writers for Cloud Infrastructure Services.