mongodb_exporter

MongoDB Exporter Docker Image

MongoDB的Prometheus导出器,支持分片、复制和存储引擎相关监控指标

13 次收藏下载次数: 0状态:社区镜像维护者:percona仓库类型:镜像最近更新:
下载命令
点击查看

https://github.com/percona/mongodb_exporter/

MongoDB exporter

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
Old Percona MongoDB exporter
old 0.1x.y version (ex master branch) is moved to the release-0.1x branch.
If you ***ing migrating from the old version of the exporter - you can
use flag --compatible-mode to expose metrics in the old metric names. This
will simplify migration to the new version for you.

Flags

FlagDescriptionExample
-h, --helpShow context-sensitive help
--compatible-modeExposes new metrics in the new and old format at the same time
--discovering-modeEnable autodiscover collections from databases which set in collstats-colls and indexstats-colls
--mongodb.collstats-collsList of comma separated databases.collections to get stats--mongodb.collstats-colls=testdb.testcol1,testdb.testcol2
--mongodb.direct-connectWhether or not a direct connect should be made. Direct connections are not valid if multiple hosts are specified or an SRV URI is used--mongodb.direct-connect=false
--mongodb.indexstats-collsList of comma separated database.collections to get index stats--mongodb.indexstats-colls=db1.col1,db1.col2
--mongodb.uriMongoDB connection URI ($MONGODB_URI)--mongodb.uri=mongodb://user:pass@127.0.0.1:27017/admin?ssl=true
--mongodb.global-conn-poolUse global connection pool instead of creating new connection for each http request.
--web.listen-addressAddress to listen on for web interface and telemetry--web.listen-address=":9216"
--web.telemetry-pathMetrics expose path--web.telemetry-path="/metrics"
--log.levelOnly log messages with the given severity or above. Valid levels: [debug, info, warn, error]--log.level="error"
--disable.diagnosticdataDisable collecting metrics from getDiagnosticData
--disable.replicasetstatusDisable collecting metrics from replSetGetStatus
--disable.dbstatsDisable collecting metrics from dbStats
--versionShow version and exit

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 https://hub.docker.com/repository/docker/percona/mongodb_exporter.

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 https://docs.mongodb.com/manual/reference/built-in-roles/#mongodb-authrole-clusterMonitor.

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 typeLabel
mongosmongos
regular instance (primary or secondary)shardsvr
arbitershardsvr
standalone(empty string)
  • cl_id: Cluster ID
  • rs_nm: Replicaset name
  • rs_state: Replicaset state is an integer from getDiagnosticData() -> replSetGetStatus.myState. Check https://docs.mongodb.com/manual/reference/replica-states/ for details on replicaset status values.

Submitting Bug Reports and adding new functionality

please see Contribution Guide

镜像拉取方式

您可以使用以下命令拉取该镜像。请将 <标签> 替换为具体的标签版本。如需查看所有可用标签版本,请访问 标签列表页面。

轩辕镜像加速拉取命令点我查看更多 mongodb_exporter 镜像标签

docker pull docker.xuanyuan.run/percona/mongodb_exporter:<标签>

DockerHub 原生拉取命令

docker pull percona/mongodb_exporter:<标签>
专业版 · 高速稳定拉取镜像
50GB 仅 ¥8/年
高速镜像下载在线技术支持专业版保障服务可用付费会员免广告