committed by
Cameron Sparr
parent
c114849a31
commit
40dccf5b29
@@ -51,3 +51,4 @@ and create a single measurement containing values e.g.
|
||||
* ttl_deletes_per_sec
|
||||
* ttl_passes_per_sec
|
||||
* repl_lag
|
||||
* jumbo_chunks (only if mongos or mongo config)
|
||||
|
||||
@@ -57,6 +57,10 @@ var DefaultReplStats = map[string]string{
|
||||
"repl_lag": "ReplLag",
|
||||
}
|
||||
|
||||
var DefaultClusterStats = map[string]string{
|
||||
"jumbo_chunks": "JumboChunksCount",
|
||||
}
|
||||
|
||||
var MmapStats = map[string]string{
|
||||
"mapped_megabytes": "Mapped",
|
||||
"non-mapped_megabytes": "NonMapped",
|
||||
@@ -74,6 +78,7 @@ func (d *MongodbData) AddDefaultStats() {
|
||||
if d.StatLine.NodeType != "" {
|
||||
d.addStat(statLine, DefaultReplStats)
|
||||
}
|
||||
d.addStat(statLine, DefaultClusterStats)
|
||||
if d.StatLine.StorageEngine == "mmapv1" {
|
||||
d.addStat(statLine, MmapStats)
|
||||
} else if d.StatLine.StorageEngine == "wiredTiger" {
|
||||
|
||||
@@ -133,6 +133,7 @@ func TestStateTag(t *testing.T) {
|
||||
"vsize_megabytes": int64(0),
|
||||
"ttl_deletes_per_sec": int64(0),
|
||||
"ttl_passes_per_sec": int64(0),
|
||||
"jumbo_chunks": int64(0),
|
||||
}
|
||||
acc.AssertContainsTaggedFields(t, "mongodb", fields, stateTags)
|
||||
}
|
||||
|
||||
@@ -36,9 +36,16 @@ func (s *Server) gatherData(acc telegraf.Accumulator) error {
|
||||
log.Println("Not gathering replica set status, member not in replica set")
|
||||
}
|
||||
|
||||
jumbo_chunks, _ := s.Session.DB("config").C("chunks").Find(bson.M{"jumbo": true}).Count()
|
||||
|
||||
result_cluster := &ClusterStatus{
|
||||
JumboChunksCount: int64(jumbo_chunks),
|
||||
}
|
||||
|
||||
result := &MongoStatus{
|
||||
ServerStatus: result_server,
|
||||
ReplSetStatus: result_repl,
|
||||
ClusterStatus: result_cluster,
|
||||
}
|
||||
|
||||
defer func() {
|
||||
|
||||
@@ -34,6 +34,7 @@ type MongoStatus struct {
|
||||
SampleTime time.Time
|
||||
ServerStatus *ServerStatus
|
||||
ReplSetStatus *ReplSetStatus
|
||||
ClusterStatus *ClusterStatus
|
||||
}
|
||||
|
||||
type ServerStatus struct {
|
||||
@@ -64,6 +65,11 @@ type ServerStatus struct {
|
||||
Metrics *MetricsStats `bson:"metrics"`
|
||||
}
|
||||
|
||||
// ClusterStatus stores information related to the whole cluster
|
||||
type ClusterStatus struct {
|
||||
JumboChunksCount int64
|
||||
}
|
||||
|
||||
// ReplSetStatus stores information from replSetGetStatus
|
||||
type ReplSetStatus struct {
|
||||
Members []ReplSetMember `bson:"members"`
|
||||
@@ -387,6 +393,9 @@ type StatLine struct {
|
||||
NumConnections int64
|
||||
ReplSetName string
|
||||
NodeType string
|
||||
|
||||
// Cluster fields
|
||||
JumboChunksCount int64
|
||||
}
|
||||
|
||||
func parseLocks(stat ServerStatus) map[string]LockUsage {
|
||||
@@ -665,5 +674,8 @@ func NewStatLine(oldMongo, newMongo MongoStatus, key string, all bool, sampleSec
|
||||
}
|
||||
}
|
||||
|
||||
newClusterStat := *newMongo.ClusterStatus
|
||||
returnVal.JumboChunksCount = newClusterStat.JumboChunksCount
|
||||
|
||||
return returnVal
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user