|
osmar.olivo, kaloian.manassiev: this has already been implemented as part of the $currentOp aggregation stage (see abridged sample output below).
I'm going to close this as a dupe of SERVER-29546 - please let me know if you think it needs to be reopened for any reason.
mongos> use admin
|
mongos> db.getMongo().setReadPref("secondary")
|
mongos> db.aggregate([{$currentOp: {idleConnections: true}}])
|
...
|
{
|
"shard" : "shard01",
|
"host" : "SEELE:27019",
|
"desc" : "ReplBatcher",
|
"active" : true,
|
"currentOpTime" : "2018-04-17T18:51:33.523+0100",
|
"opid" : "shard01:9287",
|
"op" : "none",
|
"ns" : "",
|
"command" : {
|
|
},
|
"numYields" : 0,
|
"locks" : {
|
|
},
|
"waitingForLock" : false,
|
"lockStats" : {
|
|
}
|
}
|
{
|
"shard" : "shard02",
|
"host" : "SEELE:27022",
|
"desc" : "ReplBatcher",
|
"active" : true,
|
"currentOpTime" : "2018-04-17T18:51:33.523+0100",
|
"opid" : "shard02:9214",
|
"op" : "none",
|
"ns" : "",
|
"command" : {
|
|
},
|
"numYields" : 0,
|
"locks" : {
|
|
},
|
"waitingForLock" : false,
|
"lockStats" : {
|
|
}
|
}
|
{
|
"shard" : "shard03",
|
"host" : "SEELE:27025",
|
"desc" : "ReplBatcher",
|
"active" : true,
|
"currentOpTime" : "2018-04-17T18:51:33.524+0100",
|
"opid" : "shard03:9192",
|
"op" : "none",
|
"ns" : "",
|
"command" : {
|
|
},
|
"numYields" : 0,
|
"locks" : {
|
|
},
|
"waitingForLock" : false,
|
"lockStats" : {
|
|
}
|
}
|
...
|
{
|
"shard" : "shard01",
|
"host" : "SEELE:27019",
|
"op" : "getmore",
|
"ns" : "admin.$cmd",
|
"command" : {
|
"getMore" : NumberLong("7629546417730682760"),
|
"collection" : "$cmd.aggregate",
|
"batchSize" : NumberLong(101),
|
"$db" : "admin"
|
},
|
"originatingCommand" : {
|
"aggregate" : 1,
|
"pipeline" : [
|
{
|
"$currentOp" : {
|
"idleConnections" : true
|
}
|
}
|
],
|
"fromMongos" : true,
|
"needsMerge" : true,
|
"cursor" : {
|
"batchSize" : 0
|
},
|
"$readPreference" : {
|
"mode" : "secondary"
|
},
|
"$db" : "admin"
|
},
|
}
|
...
|
|