DEV Community

Cover image for Step by Step tutorial to monitor third-party apps using Prometheus (MongoDB example πŸƒ)
TechWorld with Nana
TechWorld with Nana

Posted on β€’ Edited on

3 1

Step by Step tutorial to monitor third-party apps using Prometheus (MongoDB example πŸƒ)

In this step by step tutorial you learn how to monitor any third-party application in your Kubernetes cluster using Prometheus Monitoring.

In the demo I deploy MongoDB as an example.

CONTEXT:

A typical scenario would be that you have an application deployed in your Kubernetes cluster and at some point you decide that you want to monitor it using Prometheus.

Pre-requisites:

  • Minikube cluster installed (How to install Minikube)
  • Demo part 1: In the first part of the demo we have already deployed Prometheus Operator using Helm and I explained all the components, which were created. (Part 1 of the demo)

Steps to setup monitoring for MongoDB πŸ”

Steps to setup monitoring for MongoDB

1. Deploy MongoDB Application πŸƒ

First we will deploy the MongoDB application in our cluster. In order to do that, we need to create a MongoDB Deployment and Service.

2. Expose metrics - deploy MongoDB Exporter

As a second step we need to expose the data or the metrics of the MongoDB application using a component called Exporter.
Each application like MongoDB, Mysql, Redis has its own Exporter.

A Exporter is basically a translator between your apps data to metrics or data that Prometheus understands. It does 2 things:

  1. It collects the metrics data from the app and converts it to Prometheus understandable data
  2. It exposes these metrics to /metrics endpoint for Prometheus to be able to scrape it.

3. Allow Prometheus πŸ”₯ to scrape metrics - Deploy ServiceMonitor

Once the metrics are exposed through the MongoDB exporter, we allow Prometheus to scrape these data. This is done using a component called Service Monitor.

4. View the scraped data in Prometheus UI and Grafana πŸ‘€

Finally, when we have configured the above we will see the new target in Prometheus UI and I also show the scraped data in Grafana UI.

Explaining all the concepts πŸ’‘

Along the process I explain all the concepts in detail, like

  • What is a Exporter?
  • What is a ServiceMonitor?
  • How Prometheus discovers new targets? So that you understand those concepts and afterwards see how to use it in practice.

Watch the full video here πŸ€“


β–Ί Kubernetes 101: Compact and easy-to-read ebook bundle πŸš€
It's a handy way to quickly look something up or refresh your knowledge at work and use it as your cheatsheet 😎

Like, share and follow me 😍 for more content:

Billboard image

Deploy and scale your apps on AWS and GCP with a world class developer experience

Coherence makes it easy to set up and maintain cloud infrastructure. Harness the extensibility, compliance and cost efficiency of the cloud.

Learn more

Top comments (0)

AWS Security LIVE!

Tune in for AWS Security LIVE!

Join AWS Security LIVE! for expert insights and actionable tips to protect your organization and keep security teams prepared.

Learn More

πŸ‘‹ Kindness is contagious

Explore a sea of insights with this enlightening post, highly esteemed within the nurturing DEV Community. Coders of all stripes are invited to participate and contribute to our shared knowledge.

Expressing gratitude with a simple "thank you" can make a big impact. Leave your thanks in the comments!

On DEV, exchanging ideas smooths our way and strengthens our community bonds. Found this useful? A quick note of thanks to the author can mean a lot.

Okay