Prometheus Monitoring Tutorial
Setup Docker Environment
The first thing we’ll do is a machine up and running for this solution. This tutorial assumes you will be using Ubuntu 16.04.
If you don’t know how to create a Digital Ocean droplet or SSH into the machine you can follow this article on Medium.
Build the Prometheus Stack
Once you’ve created the Ubuntu server, run the following command in the shell terminal:
curl https://raw.githubusercontent.com/PagerTree/prometheus-grafana-alertmanager-example/master/install.sh -H 'Cache-Control: no-cache' | sudo sh; cd prometheus-grafana-alertmanager-example;
At this point you’ll have automagically deployed the entire Prometheus, Grafana, and Alert Manager stack. You can now access the Grafana dashboard from your browser at: Address:
http://<Host IP Address>:3000, Username:
Discover better on-call.
14-day free trial. No credit card required.TRY FOR FREE
Add the Prometheus Datasource to Grafana
As of this writing Grafana still does not support auto importing data sources, so we’ll have to do it manually.
- Click the
GrafanaMenu at the top left corner (looks like a fireball)
- Click the green button
Add Data Source.
- Input the following parameters exactly as shown
- Name -
Prometheus, Default -
- Type -
- HTTP settings
- URL -
- Access -
- URL -
- Name -
Save & Test
Awesome! Now if you navigate to the Dashboards in Grafana you will see data populating and some nice looking graphs.
- Click the
GrafanaMenu at the top left corner
At this point you’ll then 2 dashboards. They are pretty cool. Check them out. When your ready, head down to the Configure Alerts Section.
Now while the dashboards are cool, it would be even cooler if we were able to get alerted when something went wrong. Luckily for us, this project will create an alert after 30 seconds of high CPU. So let’s try to make use of it.
Create the PagerTree Webhook
In your PagerTree Dashboard
- From the navigation menu, click the “+ Integration” button.
- In the “Create Integration” box, fill out the following:
Warning Ensure that for this team you are the Layer 1 on-call and that you have at least 1 notification method setup.
- Name of the Integration,
- Select the Integration Type to Prometheus
- Select an appropriate urgency for when this integration is triggered
- Select the team this incident will be assigned to
- Click “Create”
- Copy the Endpoint URL
Modify the Alert Manager Configuration
Now we want to modify the alert manager configuration to make use of our PagerTree Webhook. Run the following command and make sure to replace
<Your PagerTree Webhook URL> with the you copied.
./util/alertmanager-configure-pagertree.sh <Your PagerTree Webhook URL>;
After you have run the configuration script, restart the stack with the following command:
Simulate an Alert Worthy Incident
In order for us to get an alert we’ll wan to simulate some sort of Alert Worthy Incident. From the shell terminal, run the following command:
Now we’ll wait for 30 seconds or so, and if you’ve followed all the steps correctly you should get a notification saying something like
Instance under high load.
Congrats! You’re done!
If you are reading this give yourself a pat on the back. Good job! You’ve successfully deployed a Prometheus monitoring system, hooked it up to Grafana, and configured and alerts to go to your PagerTree account.
This project is intended just to be a quick tutorial. Before being production worthy, several security considerations should be implemented.