diff --git a/plugins/inputs/mongodb/README.md b/plugins/inputs/mongodb/README.md index 678d80c73184d..89d2cc586b1ee 100644 --- a/plugins/inputs/mongodb/README.md +++ b/plugins/inputs/mongodb/README.md @@ -248,6 +248,8 @@ by running Telegraf with the `--debug` argument. - ok (integer) - storage_size (integer) - type (string) + - fs_used_size (integer) + - fs_total_size (integer) - mongodb_col_stats - tags: diff --git a/plugins/inputs/mongodb/mongodb_data.go b/plugins/inputs/mongodb/mongodb_data.go index e26c0e45231eb..1af0018d108e4 100644 --- a/plugins/inputs/mongodb/mongodb_data.go +++ b/plugins/inputs/mongodb/mongodb_data.go @@ -245,15 +245,17 @@ var defaultStorageStats = map[string]string{ } var dbDataStats = map[string]string{ - "collections": "Collections", - "objects": "Objects", - "avg_obj_size": "AvgObjSize", - "data_size": "DataSize", - "storage_size": "StorageSize", - "num_extents": "NumExtents", - "indexes": "Indexes", - "index_size": "IndexSize", - "ok": "Ok", + "collections": "Collections", + "objects": "Objects", + "avg_obj_size": "AvgObjSize", + "data_size": "DataSize", + "storage_size": "StorageSize", + "num_extents": "NumExtents", + "indexes": "Indexes", + "index_size": "IndexSize", + "ok": "Ok", + "fs_used_size": "FsUsedSize", + "fs_total_size": "FsTotalSize", } var colDataStats = map[string]string{ diff --git a/plugins/inputs/mongodb/mongostat.go b/plugins/inputs/mongodb/mongostat.go index 2490ca2c1777c..c75b93db4c24c 100644 --- a/plugins/inputs/mongodb/mongostat.go +++ b/plugins/inputs/mongodb/mongostat.go @@ -96,6 +96,8 @@ type DbStatsData struct { IndexSize int64 `bson:"indexSize"` Ok int64 `bson:"ok"` GleStats interface{} `bson:"gleStats"` + FsUsedSize int64 `bson:"fsUsedSize"` + FsTotalSize int64 `bson:"fsTotalSize"` } type ColStats struct { @@ -837,6 +839,8 @@ type DbStatLine struct { Indexes int64 IndexSize int64 Ok int64 + FsUsedSize int64 + FsTotalSize int64 } type ColStatLine struct { Name string @@ -1361,6 +1365,8 @@ func NewStatLine(oldMongo, newMongo MongoStatus, key string, all bool, sampleSec Indexes: dbStatsData.Indexes, IndexSize: dbStatsData.IndexSize, Ok: dbStatsData.Ok, + FsTotalSize: dbStatsData.FsTotalSize, + FsUsedSize: dbStatsData.FsUsedSize, } returnVal.DbStatsLines = append(returnVal.DbStatsLines, *dbStatLine) }