Add shard server stats to the mongodb input plugin (#3808)
This commit is contained in:
committed by
Daniel Nelson
parent
1fc8b2c71e
commit
3e31ae4eca
@@ -55,8 +55,18 @@ func (s *Server) gatherData(acc telegraf.Accumulator, gatherDbStats bool) error
|
||||
JumboChunksCount: int64(jumbo_chunks),
|
||||
}
|
||||
|
||||
result_db_stats := &DbStats{}
|
||||
resultShards := &ShardStats{}
|
||||
err = s.Session.DB("admin").Run(bson.D{
|
||||
{
|
||||
Name: "shardConnPoolStats",
|
||||
Value: 1,
|
||||
},
|
||||
}, &resultShards)
|
||||
if err != nil {
|
||||
log.Println("E! Error getting database shard stats (" + err.Error() + ")")
|
||||
}
|
||||
|
||||
result_db_stats := &DbStats{}
|
||||
if gatherDbStats == true {
|
||||
names := []string{}
|
||||
names, err = s.Session.DatabaseNames()
|
||||
@@ -88,6 +98,7 @@ func (s *Server) gatherData(acc telegraf.Accumulator, gatherDbStats bool) error
|
||||
ReplSetStatus: result_repl,
|
||||
ClusterStatus: result_cluster,
|
||||
DbStats: result_db_stats,
|
||||
ShardStats: resultShards,
|
||||
}
|
||||
|
||||
defer func() {
|
||||
|
||||
Reference in New Issue
Block a user