Skip to content

Telegraf plugin for mongodb try to gather_col_stats on collection type VIEW #11270

@mishutka-mmx

Description

@mishutka-mmx

Relevant telegraf.conf

[[outputs.file]]
   ## Files to write to, "stdout" is a specially handled file.
   files = ["stdout", "/root/metrics.out"]

     data_format = "influx"
[[inputs.mongodb]]

servers = ["mongodb://telegraf:manager@localhost:27017/admin"]
gather_cluster_status = true
gather_perdb_stats = true
gather_col_stats = true
gather_top_stat = true
col_stats_dbs = []
interval = "30s"

Logs from Telegraf

[root@gmv01ndbmgr01 ~]# /usr/bin/telegraf --config ./my.conf --debug  
2022-06-08T09:13:19Z I! Starting Telegraf 1.22.3
2022-06-08T09:13:19Z I! Loaded inputs: mongodb
2022-06-08T09:13:19Z I! Loaded aggregators: 
2022-06-08T09:13:19Z I! Loaded processors: 
2022-06-08T09:13:19Z I! Loaded outputs: file
2022-06-08T09:13:19Z I! Tags enabled: LifeCycle=Text host=gmv01ndbmgr01 ims_system_id=666
2022-06-08T09:13:19Z I! [agent] Config: Interval:10s, Quiet:false, Hostname:"gmv01ndbmgr01", Flush Interval:10s
2022-06-08T09:13:19Z D! [agent] Initializing plugins
2022-06-08T09:13:19Z D! [agent] Connecting outputs
2022-06-08T09:13:19Z D! [agent] Attempting connection to [outputs.file]
2022-06-08T09:13:19Z D! [agent] Successfully connected to outputs.file
2022-06-08T09:13:19Z D! [agent] Starting service inputs
2022-06-08T09:13:29Z D! [outputs.file] Buffer fullness: 0 / 10000 metrics
2022-06-08T09:13:30Z E! [inputs.mongodb] error getting col stats from "system.tenantMigration.oplogView": (CommandNotSupportedOnView) Namespace local.system.tenantMigration.oplogView is a view, not a collection

System info

Telegraf 1.22.3

Docker

No response

Steps to reproduce

1.mongodb 5.0.9
2. telegraf user has root permissions in mangodb
3. Simple config for telegraf to run

Expected behavior

Telegraf mongodb plugin should gather_col_stats on collection "type" : "collection"

Actual behavior

Telegraf mongodb plugin gather gather_col_stats on all types of collections

Additional info

Hello.

MongoDb does not support collStats commad on collectin type view.

Example:

MYRS:PRIMARY> use local
switched to db local
MYRS:PRIMARY> show collections
oplog.rs
replset.election
replset.initialSyncId
replset.minvalid
replset.oplogTruncateAfterPoint
startup_log
system.replset
system.rollback.id
system.tenantMigration.oplogView
system.views
MYRS:PRIMARY> db.runCommand( { collStats : "system.tenantMigration.oplogView" } )
{
"ok" : 0,
"errmsg" : "Namespace local.system.tenantMigration.oplogView is a view, not a collection",
"code" : 166,
"codeName" : "CommandNotSupportedOnView",
"$clusterTime" : {
"clusterTime" : Timestamp(1654680040, 1),
"signature" : {
"hash" : BinData(0,"NqmNCz7AR6ZvHq05VXuEobarqyw="),
"keyId" : NumberLong("7106730213999902725")
}
},
"operationTime" : Timestamp(1654680040, 1)
}

Telegraf plugin try to gather_col_stats on collection type "view" , and also gets error :

2022-06-08T09:13:30Z E! [inputs.mongodb] error getting col stats from "system.tenantMigration.oplogView": (CommandNotSupportedOnView) Namespace local.system.tenantMigration.oplogView is a view, not a collection

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/mongodbbugunexpected problem or unintended behaviorhelp wantedRequest for community participation, code, contribution

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions