How install and Configure Prometheus in a Docker Container on AWS EC2 instance.

alternative

P rometheus is an open-source tool for metrics collection. It collects the metrics from static or dynamic environment and stores in a time series database.

Prometheus is pull-based system. it sends an HTTP request, a so-called scrape, based on the configuration defined in the prometheus.yml file discussed below. The response to this scrape request is stored and parsed in the storage along with the metrics for the scrape itself.

Prerequisites:

AWS Account with the running AWS EC2-Ubuntu-18 machine.

Step1: SSH into your machine and Install Docker..

Now, we will discuss the core components of AWS services:

alternative

Step2: Define Configuration File.

We are going to pull Prometheus image from docker.hub. Lets create the configuration file for Prometheus at “/root/prometheus.yml”.

alternative

There are two targets for the Prometheus server. First is your localhost and second is your Ubuntu machine public IP.

Step3: Launch Prometheus Container.

alternative

The image to be pulled is prom/prometheus from docker.hub and the Prometheus server will run on port number 9090, that is binded to your Ubuntu machine port 9090.

Step4: Configure your security group of AWS EC2 instance.

Select your running Ubuntu machine go to the security group->edit inbound rules->Add Rule. Allow the following ports as shown below.

alternative

Step5: Launch the Prometheus Dashboard.

Open your browser and type- http://54.167.231.125:9090/targets

alternative

Step6: Setting the Node Exporter.

Node Exporter is a Prometheus exporter for hardware and OS metrics with plug-able metric collectors. It allows to measure various machine resources such as memory, disk and CPU utilization.

alternative

Step7: Open Dashboard.

Open the the browser and hit the same url you hit above http://54.167.231.125:9090/targets

alternative

Thank you so much for reading, I have tried it to explain this with some live example. Hope you like it see you again in next topic.

Conclusion:

Awesome! we did it. We didthe whole setup with some easy steps.Thanks for reading. Please write the response if we can do it in better way.

Happy Devops!

loading..
WRITTEN BY

Arpita Srivastava

HUMANIST, Devops, Learner, Implementer, Traveller


Unlearn, Learn, and Grow

  • Come, join DevTorq, a league to fulfill your dreams with the right career path.
  • BHive, 27th Main, 2nd Sector, HSR Layout, Bengaluru, Karnataka - 560102

Hello DevTorq!

I have read and agree with Devtorq stated Privacy Policy and Terms Conditions