Giter Club home page Giter Club logo

mongodb_exporter's Introduction

MongoDB exporter

Release Build Status codecov.io Code Coverage Go Report Card CLA assistant Discord

This is the new MongoDB exporter implementation that handles ALL metrics exposed by MongoDB monitoring commands. This new implementation loops over all the fields exposed in diagnostic commands and tries to get data from them.

Currently, these metric sources are implemented:

  • $collStats
  • $indexStats
  • getDiagnosticData
  • replSetGetStatus
  • serverStatus

Info on Percona MongoDB exporter versions

The old 0.1x.y version (ex master branch) has been moved to the release-0.1x branch.

A flag, --compatible-mode, which exposes metrics with 0.1x compatible metric names has been implemented which simplifies migration from the old version to the current version.

Build the exporter

The build process uses the dockerized version of goreleaser so you don't need to install Go. Just run make release and the new binaries will be generated under the build directory.

├── build
│ ├── config.yaml
│ ├── mongodb_exporter_7c73946_checksums.txt
│ ├── mongodb_exporter-7c73946.darwin-amd64.tar.gz
│ ├── mongodb_exporter-7c73946.linux-amd64.tar.gz
│ ├── mongodb_exporter_darwin_amd64
│ │ └── mongodb_exporter <--- MacOS binary
│ └── mongodb_exporter_linux_amd64
│ └── mongodb_exporter <--- Linux binary

Running the exporter

If you built the exporter using the method mentioned in the previous section, the generated binaries are in mongodb_exporter_linux_amd64/mongodb_exporter or mongodb_exporter_darwin_amd64/mongodb_exporter

Docker

A docker image is available on the official percona repository.

Examples
# with podman
podman run -d -p 9216:9216 -p 17001:17001 percona/mongodb_exporter:0.20 --mongodb.uri=mongodb://127.0.0.1:17001

# with docker
docker run -d -p 9216:9216 -p 17001:17001 percona/mongodb_exporter:0.20 --mongodb.uri=mongodb://127.0.0.1:17001

Permissions

Connecting user should have sufficient rights to query needed stats:

      {
         "role":"clusterMonitor",
         "db":"admin"
      },
      {
         "role":"read",
         "db":"local"
      }

More info about roles in MongoDB documentation.

Example

mongodb_exporter_linux_amd64/mongodb_exporter --mongodb.uri=mongodb://127.0.0.1:17001

Enabling collstats metrics gathering

--mongodb.collstats-colls receives a list of databases and collections to monitor using collstats. Usage example: --mongodb.collstats-colls=database1.collection1,database2.collection2

mongodb_exporter_linux_amd64/mongodb_exporter --mongodb.uri=mongodb://127.0.0.1:17001 --mongodb.collstats-colls=db1.c1,db2.c2

Enabling compatibility mode.

When compatibility mode is enabled by the --compatible-mode, the exporter will expose all new metrics with the new naming and labeling schema and at the same time will expose metrics in the version 1 compatible way. For example, if compatibility mode is enabled, the metric mongodb_ss_wt_log_log_bytes_written (new format)

# HELP mongodb_ss_wt_log_log_bytes_written serverStatus.wiredTiger.log.
# TYPE mongodb_ss_wt_log_log_bytes_written untyped
mongodb_ss_wt_log_log_bytes_written 2.6208e+06

will be also exposed as mongodb_mongod_wiredtiger_log_bytes_total with the unwritten label.

HELP mongodb_mongod_wiredtiger_log_bytes_total mongodb_mongod_wiredtiger_log_bytes_total
# TYPE mongodb_mongod_wiredtiger_log_bytes_total untyped
mongodb_mongod_wiredtiger_log_bytes_total{type="unwritten"} 2.6208e+06

Cluster role labels

The exporter sets some topology labels in all metrics. The labels are:

  • cl_role: Cluster role according to this table:
Server type Label
mongos mongos
regular instance (primary or secondary) shardsvr
arbiter shardsvr
standalone (empty string)
  • cl_id: Cluster ID
  • rs_nm: Replicaset name
  • rs_state: Replicaset state is an integer from getDiagnosticData() -> replSetGetStatus.myState. Check the official documentation for details on replicaset status values.

Usage Reference

See the Reference Guide for details on using the exporter.

Bug Reports / Feature PR

Refer to the Contribution Guide.

mongodb_exporter's People

Contributors

percona-csalguero avatar dependabot[bot] avatar shashanksinha252 avatar bupychuk avatar denisok avatar dliakhov avatar jirictvrtka avatar dependabot-preview[bot] avatar aleksi avatar kbudde avatar ritbl avatar masaruhoshi avatar rnovikovp avatar kanakagrawal avatar trvrnrth avatar algestam avatar yaroslavpodorvanov avatar rfratto avatar weastur avatar hiroshi avatar aravandi avatar d4nnyx avatar arggh avatar 123blin avatar rlankfo avatar relzhong avatar ramunas-omnisend avatar beliys avatar naughtygitcat avatar delgod avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.