How to configure Portainer and Prometheus in containers

Appfire products

Software development and DevOps

System administration

Business intelligence and reporting

Project and portfolio management

how-to-configure-portainer-and-prometheus-in-containers
Appfire

Appfire

Nov 11, 2021

Hello! Alexey Matveev here.

In this article, I’ll be showing you how Portainer and Prometheus work together using docker containers.

Here is our file structure after we have created all files from this article:

portainer_1-1024x204.webp

Files for Prometheus

Our Prometheus container will select metrics from Jira and send alerts to a Slack channel. You can watch this video for more details.


prometheus.yml

portainer_2-1024x360.webp


rules.yml

portainer_3-1024x361.webp


alertmanager.yml

portainer_4_low-1024x641.webp

Run Portainer

Portainer lets you manage your docker containers via web UI. Let’s create a docker-compose.yml file in the /home/user/docker folder:

portainer_4b-1024x240.webp


Run this docker-compose.yml file with:

portainer_5-1-1024x49.webp

Now our Portainer runs on port 8080.

Create Prometheus stack in Portainer

Now we can log in to Portainer with localhost:8080.

We will be asked to set the password for the admin user:

portainer_6new-1024x679.webp

Set the password and push the Create user button: 

portainer_7-1024x644.webp

Choose Local:

portainer_8-1024x553.webp

Push the Connect button:

portainer_9-1024x547.webp

Click on the available docker:

portainer_10-1024x520.webp

Click on the Stacks section:

portainer_11-1024x527.webp

Click on the Stacks section:

portainer_12-1-1024x431.webp

portainer_13-1-1024x544.webp

Push the Deploy button:

portainer_14-1024x543.webp

Click on the Prometheus stack:

portainer_15-1024x542.webp

We have Prometheus on localhost:9090 and alert manager on localhost:9093. Now, try it out yourself!

Appfire

Appfire

Appfire is the leading global provider of software that enhances, extends, and connects the world's leading platforms to make work flow any way teams want to work, from planning to product ideation, product development, project delivery, and beyond. Articles posted by Appfire are written by internal team members.