Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(mongodb): add FsTotalSize and FsUsedSize informations #10625

Merged
merged 1 commit into from
Feb 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions plugins/inputs/mongodb/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
20 changes: 11 additions & 9 deletions plugins/inputs/mongodb/mongodb_data.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down
6 changes: 6 additions & 0 deletions plugins/inputs/mongodb/mongostat.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -837,6 +839,8 @@ type DbStatLine struct {
Indexes int64
IndexSize int64
Ok int64
FsUsedSize int64
FsTotalSize int64
}
type ColStatLine struct {
Name string
Expand Down Expand Up @@ -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)
}
Expand Down