Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with gathering stats in MongoDB 5.0.2 v2 #9968

Closed
ypuzyrev opened this issue Oct 21, 2021 · 4 comments
Closed

Problem with gathering stats in MongoDB 5.0.2 v2 #9968

ypuzyrev opened this issue Oct 21, 2021 · 4 comments
Labels
area/exec bug unexpected problem or unintended behavior

Comments

@ypuzyrev
Copy link

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-1, OS = CentOS8, db = MongoDB 5.0.2

Steps to reproduce:

  1. Install MongoDB 5.0.2
  2. Configure and start telegraf 1.20.0-1
  3. Previous problem: Problem with gather in MongoDB 5.0 #9622

Expected behavior:

Gathering stats.

Actual behavior:

Take a bug:

Oct  5 09:44:00 mongo-test-01 telegraf[1286865]: panic: interface conversion: interface {} is nil, not bool
Oct  5 09:44:00 mongo-test-01 telegraf[1286865]: goroutine 188 [running]:
Oct  5 09:44:00 mongo-test-01 telegraf[1286865]: github.com/influxdata/telegraf/plugins/inputs/mongodb.NewStatLine({{0xc04f2575808fb5ae, 0x244159a4d, 0x7d68800}, 0xc00
0c1b7a0, 0xc000156620, 0xc001411570, 0xc0011660a8, 0x0, 0xc0011b7d10, 0xc001108cd8, ...}, ...)
Oct  5 09:44:00 mongo-test-01 telegraf[1286865]: #011/go/src/github.com/influxdata/telegraf/plugins/inputs/mongodb/mongostat.go:1166 +0x2d85
Oct  5 09:44:00 mongo-test-01 telegraf[1286865]: github.com/influxdata/telegraf/plugins/inputs/mongodb.(*Server).gatherData(0xc0010bd590, {0x542d1a0, 0xc00047d440}, 0x
1, 0x0, 0x0, 0x0, {0xc00044ac50, 0x1, 0x1})
Oct  5 09:44:00 mongo-test-01 telegraf[1286865]: #011/go/src/github.com/influxdata/telegraf/plugins/inputs/mongodb/mongodb_server.go:353 +0x779
Oct  5 09:44:00 mongo-test-01 telegraf[1286865]: github.com/influxdata/telegraf/plugins/inputs/mongodb.(*MongoDB).Gather.func1(0x0)
Oct  5 09:44:00 mongo-test-01 telegraf[1286865]: #011/go/src/github.com/influxdata/telegraf/plugins/inputs/mongodb/mongodb.go:167 +0x97
Oct  5 09:44:00 mongo-test-01 telegraf[1286865]: created by github.com/influxdata/telegraf/plugins/inputs/mongodb.(*MongoDB).Gather
Oct  5 09:44:00 mongo-test-01 telegraf[1286865]: #011/go/src/github.com/influxdata/telegraf/plugins/inputs/mongodb/mongodb.go:165 +0x68
Oct  5 09:44:00 mongo-test-01 systemd[1]: telegraf.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
Oct  5 09:44:00 mongo-test-01 systemd[1]: telegraf.service: Failed with result 'exit-code'.
Oct  5 09:44:00 mongo-test-01 systemd[1]: telegraf.service: Service RestartSec=100ms expired, scheduling restart.
Oct  5 09:44:00 mongo-test-01 systemd[1]: telegraf.service: Scheduled restart job, restart counter is at 4.
Oct  5 09:44:00 mongo-test-01 systemd[1]: Stopped The plugin-driven server agent for reporting metrics into InfluxDB.

Statistics not gathering

@ypuzyrev ypuzyrev added the bug unexpected problem or unintended behavior label Oct 21, 2021
@denispershin
Copy link
Contributor

denispershin commented Oct 24, 2021

Hi! Could you directly connect to you node, run db.ServerStatus(), find "repl" section and put here? "repl" output looks like https://docs.mongodb.com/manual/reference/command/serverStatus/#repl

@ypuzyrev
Copy link
Author

Hi! My "repl" section:
"repl" : { "topologyVersion" : { "processId" : ObjectId("610b890a4916bc15a2052144"), "counter" : NumberLong(8) }, "hosts" : [ "t-srvpm-db01.t-services-platform-834.x2.cloud.lmru.tech:11100" ], "setName" : "testCluster", "setVersion" : 2, "isWritablePrimary" : true, "secondary" : false, "primary" : "t-srvpm-db01.t-services-platform-834.x2.cloud.lmru.tech:11100", "me" : "t-srvpm-db01.t-services-platform-834.x2.cloud.lmru.tech:11100", "electionId" : ObjectId("7fffffff0000000000000003"), "lastWrite" : { "opTime" : { "ts" : Timestamp(1635342469, 1), "t" : NumberLong(3) }, "lastWriteDate" : ISODate("2021-10-27T13:47:49Z"), "majorityOpTime" : { "ts" : Timestamp(1635342469, 1), "t" : NumberLong(3) }, "majorityWriteDate" : ISODate("2021-10-27T13:47:49Z") }, "primaryOnlyServices" : { "TenantMigrationDonorService" : { "state" : "running", "numInstances" : 0 }, "TenantMigrationRecipientService" : { "state" : "running", "numInstances" : 0 } }, "rbid" : 1 },

@denispershin
Copy link
Contributor

@ypuzyrev Thank you, it seems mongo delete "ismaster" field since 5 version from serverStatus.

@denispershin
Copy link
Contributor

It has been fixed #9892

ygsa added a commit to ygsa/telegraf that referenced this issue Sep 12, 2023
ygsa added a commit to ygsa/telegraf that referenced this issue Sep 12, 2023
hhttps://github.com/influxdata/pull/9892
(cherry picked from commit bf65b02)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/exec bug unexpected problem or unintended behavior
Projects
None yet
Development

No branches or pull requests

3 participants