- Lab
-
Libraries: If you want this lab, consider one of these libraries.
- Cloud
Setting Up Prometheus and Adding Endpoints
In this hands-on lab, we get our monitoring solution up and running by installing Prometheus, Alertmanager, and Grafana, as well as ensuring metrics from all three services are being fed into Prometheus. This gives us a full monitoring platform so we can start performing both infrastructure and application monitoring and everything in between. As we install Prometheus and Alertmanager, we'll also configure our environment so we can easily and effectively change our configurations without any added work.
Lab Info
Table of Contents
-
Challenge
Set up Prometheus
- On the
monitoringserver, create a user for Prometheus. - Create the needed directories:
/etc/prometheusand/var/lib/prometheus. - Set the ownership of the
/var/lib/prometheusdirectory. - Download Prometheus (here's the link).
- Extract the files.
- Move the configuration file to
/etc/prometheusand set the owner to theprometheususer. - Move the binaries and set the owner.
- Create the service file.
- Start Prometheus and make sure it automatically starts on boot.
- On the
-
Challenge
Set up Alertmanager
- On the
monitoringserver, create thealertmanagersystem user. - Create the needed directory:
/etc/alertmanager. - Download Alertmanager (here's the link).
- Extract the files.
- Move the binaries.
- Set the ownership of the binaries.
- Move the configuration file into the
/etc/alertmanagerdirectory. - Set the ownership of the
/etc/alertmanagerdirectory. - Create the
alertmanager.servicefile for systemd. - Stop Prometheus, and then update the Prometheus configuration file to use Alertmanager.
- Reload systemd, and then start the
prometheusandalertmanagerservices. - Make sure
alertmanagerstarts on boot.
- On the
-
Challenge
Set up Grafana
- On the
grafanaserver, install the prerequisitelibfontconfigpackage. - Download and install Grafana using the
.debpackage provided on the Grafana download page. - Start Grafana.
- Ensure Grafana starts at boot.
- Using the Grafana IP address listed on the lab page, access Grafana's web UI by navigating to
<GRAFANA_IP_ADDRESS>:3000in a new browser tab. - Log in with the username
adminand the passwordadmin. Reset the password when prompted. - Click Add data source on the home page.
- Select Prometheus.
- In the HTTP section, set the URL to
http://<MONITORING_IP_ADDRESS>:9090(using the public IP of themonitoringserver provided on the lab page). - Click Save & Test.
- On the
-
Challenge
Add Alertmanager and Grafana Endpoints to Prometheus
- On the
monitoringserver, open the Prometheus configuration file. - Add the Alertmanager endpoint.
- Add the Grafana endpoint.
- Restart Prometheus.
- Using the public IP address of the
monitoringserver, navigate to the Prometheus web UI in a new browser tab:http://<MONITORING_IP_ADDRESS>:9090 - Ensure all three endpoints are listed on the Targets page.
- On the
About the author
Real skill practice before real-world application
Hands-on Labs are real environments created by industry experts to help you learn. These environments help you gain knowledge and experience, practice without compromising your system, test without risk, destroy without fear, and let you learn from your mistakes. Hands-on Labs: practice your skills before delivering in the real world.
Learn by doing
Engage hands-on with the tools and technologies you’re learning. You pick the skill, we provide the credentials and environment.
Follow your guide
All labs have detailed instructions and objectives, guiding you through the learning process and ensuring you understand every step.
Turn time into mastery
On average, you retain 75% more of your learning if you take time to practice. Hands-on labs set you up for success to make those skills stick.