1. Images & Charts
  2. prometheus-mongodb-exporter
prometheus-mongodb-exporter

prometheus-mongodb-exporter

Infra
Updated on July 31

Prometheus MongoDB Exporter Overview

Secure your stack with a hardened Prometheus MongoDB Exporter image freshly-built by Minimus. Minimus images always include the most up-to-date package version for all packages and dependencies contained in the image.


The Prometheus MongoDB Exporter collects MongoDB performance and health metrics and exposes them in a format Prometheus can scrape for monitoring and visualization.


Try It Out

To take the Minimus Prometheus MongoDB Exporter for a test run, we will deploy it using Helm. For simplicity, the below example does not deploy MongoDB, Prometheus, and Grafana.

Step 1: Start Cluster

If you have a cluster to work with, skip this step. Otherwise, start a Minikube cluster. Deployment instructions

If you don't yet have Helm installed, use this installation guide.

Step 2: Add Repository and CRDs to your Local Client

Add the official Helm chart repository to your local Helm client.

helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm repo update
helm install prometheus-operator-crds prometheus-community/prometheus-operator-crds

Step 3: Create values config file

Save the following example to a mongodb-exporter-values.yaml file in your working directory:

## MongoDB Helm Chart Values
mongodb:
  uri: "mongodb://admin:password123@mongodb.grade-submission.svc.cluster.local:27017"

serviceMonitor:
  enabled: true
  interval: 30s
  scrapeTimeout: 10s
  additionalLabels:
    release: prometheus

image:
  repository: reg.mini.dev/prometheus-mongodb-exporter
  tag: latest

extraArgs:
  - --collector.diagnosticdata
  - --collector.replicasetstatus
  - --collector.dbstats
  - --collector.topmetrics
  - --collector.indexstats
  - --collector.collstats
  - --collector.dbstatsfreestorage
  - --collector.currentopmetrics
  - --collector.fcv
  - --log.level=debug

Note the recommended pull policy for Minimus images.

Step 4: Deploy prometheus-mongodb-exporter

Run the following command:

helm install mongodb-exporter prometheus-community/prometheus-mongodb-exporter \
  -f mongodb-exporter-values.yaml \
  -n mongodb \
  --create-namespace

Check that the Pod is up and running:

kubectl -n mongodb get po

Step 5: Test the WEB UI

Run the following command to port forward the service port:

kubectl port-forward svc/mongodb-exporter-prometheus-mongodb-exporter 9216 -n mongodb &

Visit https://127.0.0.1:9216/metrics to view the MongoDB metrics.


Technical Considerations

The Prometheus MongoDB Exporter image provided by Minimus is a slim, security-hardened alternative to the public image from Docker Hub. The images are largely interchangeable, with a few differences as noted below.

Prometheus MongoDB Exporter built by Minimus:

  1. Runs as non-root by default as user 1000. The public image runs as user 65535.
  2. Listens on port 9216/TCP by default without exposing it. The public image listens on and exposes the same port by default.
  3. The entrypoint is under /usr/bin/mongodb_exporter. The public image entrypoint is under /mongodb_exporter.
  4. Drill down on the version specification tab to see the default user, listening ports, entrypoint, volumes, environment variables, etc.

The Payoff

A hardened, minimal image that will remain more secure for the long run and accrue vulnerabilities at a slower rate.


Terms & Info

Trademark

This catalog is published by Minimus. All product names, logos, and marks, other than those belonging to Minimus, shown are owned by their respective rights holders and appear here only to identify the open source software each image contains. Minimus claims no ownership of those marks and implies no affiliation with, endorsement by, certification by, or sponsorship by any rights holder.

Disclaimer

Images are provided "as-is" without warranty of any kind. "Hardened" refers to the security configuration applied at the time of build and does not constitute a guarantee of ongoing security or absence of vulnerabilities. The free tier is provided without support, SLA, or guaranteed patching timelines. Security updates may be applied to paid subscriptions before or instead of free tier images. By pulling or using any image you agree to our Terms of Use.