Database Monitoring
MongoDB Monitoring
Docker-compose for MongoDB and KloudMate Backend Integration
3 min
this document provides a guide on how to use docker compose to set up mongodb and kloudmate backend integration in the described setup, docker compose will create the following three containers mongodb container mongodb exporter container otel collector container the exporter will export mongodb metrics from mongodb container and send it to kloudmate backend via otel collector container the logs of mongodb container will be sent to kloudmate by otel collector container docker compose yaml version '3 1' services mongo image mongo restart always container name mongo ports \ 27017 27017 environment mongo initdb root username \<user> mongo initdb root password \<password> mongo initdb database admin command \ ' logpath' \ '/var/log/mongodb/mongodb log' volumes \ mongodb logs\ /var/log/mongodb networks \ node network mongodb exporter image percona/mongodb exporter 0 39 container name mongodb exporter privileged true ports \ 9216 9216 \# you can provide custom params to the exporter, according to your mongodb config, like ssl support, command \ " mongodb uri=mongodb //\<user> \<password>@mongo 27017/" \ " collect all" \ " compatible mode" \ " discovering mode" \ " mongodb direct connect" depends on \ mongo networks \ node network otel collector image otel/opentelemetry collector contrib\ latest privileged true user "0" command \[" config=/etc/otel collector config yaml"] volumes \ /otel collector config yaml /etc/otel collector config yaml \ mongodb logs\ /var/log/mongodb\ ro ports \ 4317 4317 # otlp grpc receiver \ 4318 4318 # otlp http receiver \ 8888 8888 restart on failure depends on \ mongodb exporter \ mongo networks \ node network volumes mongodb logs networks node network driver bridge please change the username and password of mongo db user otel collector config yaml receivers otlp protocols grpc endpoint 0 0 0 0 4317 http endpoint 0 0 0 0 4318 filelog include \[ /var/log/mongodb/ log ] attributes service name "prod mongodb 1" operators prometheus config scrape configs \ job name 'prod mongodb' scrape interval 10s static configs \ targets \['mongodb exporter 9216'] processors batch timeout 10s exporters logging otlphttp endpoint 'https //otel kloudmate com 4318' headers authorization xxxxxxxxxxxxxxxxxxxxx #add auth token service pipelines metrics receivers \[prometheus] processors \[batch] exporters \[otlphttp] logs receivers \[otlp, filelog] processors \[batch] exporters \[logging, otlphttp] please change the auth token to send the data to kloudmate after successfully instrumenting your mongodb database with opentelemetry and integrating it with kloudmate, you can capture and monitor the various metrics within kloudmate as shown in the following screenshot