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

TechWorld with Nana - Sep 25 '20 - - Dev Community

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:

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .