Sign inSign up

andriik/mongodb-profiler-exporter

By andriik

Updated 7 months ago

Docker fimage for https://github.com/andrii29/mongodb-profiler-exporter

Image
Databases & storage
Monitoring & observability
0

50K+

andriik/mongodb-profiler-exporter repository overview

Gihub repo: mongodb-profiler-exporter

Read more at Medium

docker run --rm -it andriik/mongodb-profiler-exporter -h

usage: mongodb-profiler-exporter.py [-h] [--mongodb-uri MONGODB_URI] [--wait-interval WAIT_INTERVAL] [--max-string-size MAX_STRING_SIZE] [--listen-ip LISTEN_IP] [--listen-port LISTEN_PORT]
                                    [--metrics-endpoint METRICS_ENDPOINT]

MongoDB Prometheus Exporter

optional arguments:
  -h, --help            show this help message and exit
  --mongodb-uri MONGODB_URI
                        MongoDB URI (default: mongodb://127.0.0.1:27017/)
  --wait-interval WAIT_INTERVAL
                        Wait interval between data parsing in seconds (default: 10)
  --max-string-size MAX_STRING_SIZE
                        Maximum string size for Prometheus labels (default: 1000)
  --listen-ip LISTEN_IP
                        IP address to listen on (default: 0.0.0.0)
  --listen-port LISTEN_PORT
                        Port to listen (default: 9179)
  --metrics-endpoint METRICS_ENDPOINT
                        Metrics endpoint path (default: /metrics)

Run the exporter with default settings:

docker run --rm -it andriik/mongodb-profiler-exporter

Run with local MongoDB:

docker run --rm -it --net host andriik/mongodb-profiler-exporter

Specify a custom MongoDB URI and set the wait interval to 5 seconds:

docker run --rm -it -p 9179:9179 -e MONGODB_URI="mongodb://your-mongo-host:27017/" -e WAIT_INTERVAL=5 andriik/mongodb-profiler-exporter

Customize the IP address and port the exporter listens on:

docker run --rm -it -p 9179:9179 -e LISTEN_IP="127.0.0.1" -e LISTEN_PORT=9179 andriik/mongodb-profiler-exporter

Set a custom metrics endpoint path:

docker run --rm -it -p 9179:9179 -e METRICS_ENDPOINT="/metrics" andriik/mongodb-profiler-exporter
To set up authentication, follow these steps:
mongosh

use admin
db.createUser({
  user: "mongodb-profiler-exporter",
  pwd: passwordPrompt(),
  roles: [ { role: "clusterMonitor", db: "admin" } ]
})

docker run --rm -it -p 9179:9179 -e MONGODB_URI="mongodb://mongodb-profiler-exporter:<password>@127.0.0.1:27017/admin?authSource=admin&readPreference=primaryPreferred/" andriik/mongodb-profiler-exporter
Enable MongoDB Profiler
use db_name
db.getProfilingStatus()
db.setProfilingLevel(1, { slowms: 10 })

Tag summary

Content type

Image

Digest

sha256:a62b2dff2

Size

24.2 MB

Last updated

7 months ago

docker pull andriik/mongodb-profiler-exporter