Skip to content

Problem with gather in MongoDB 5.0 #9622

@t5virko

Description

@t5virko

Relevant telegraf.conf:

[[inputs.mongodb]]

  servers = ["mongodb://mongodb_exporter:*****@*****"]

  ## When true, collect per database stats
   gather_perdb_stats = true

  ## When true, collect per collection stats
   gather_col_stats = false

  ## List of db where collections stats are collected
  ## If empty, all db are concerned
  # col_stats_dbs = ["local"]


  ## Optional TLS Config
   tls_ca = "/ssl/ca.pem"
   tls_cert = "/ssl/mongodb.pem"
   tls_key = "/ssl/mongodb.pem"
  ## Use TLS but skip chain & host verification
   insecure_skip_verify = true

# Read metrics about cpu usage
[[inputs.cpu]]
  ## Whether to report per-cpu stats or not
  percpu = true
  ## Whether to report total system cpu stats or not
  totalcpu = true
  ## If true, collect raw CPU time metrics.
  collect_cpu_time = false

# Read metrics about memory usage
[[inputs.mem]]

[[inputs.disk]]
  mount_points = ["/", "/data"]

[[inputs.system]]

[[inputs.exec]]
  commands = ["bash /data/scripts/check_status_ssl.sh"]
  timeout = "3s"
  data_format = "influx"

 # Configuration for the Prometheus client to spawn
 [[outputs.prometheus_client]]
   ## Address to listen on
   listen = ":9216"
   collectors_exclude = ["gocollector","process"]
   metric_version = 2
   expiration_interval = "15s"

System info:

Telegraf version = 1.20.0, OS = CentOS8, db = MongoDB 5.0.2

Docker

Steps to reproduce:

  1. Install MongoDB 5.0
  2. Configure and start telegraf

Expected behavior:

Gathering stats.

Actual behavior:

Take err:
E! [inputs.mongodb] unable to gather shard connection pool stats: (CommandNotFound) no such command: 'shardConnPoolStats'

Additional info:

The bug is related to the new version of MongoDB 5.0
In version 5.0 the command "shardConnPoolStats" has been removed and replaced with "сonnPoolStats".
Link to the documentation here.

Metadata

Metadata

Assignees

Labels

area/execbugunexpected problem or unintended behavior

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions