Skip to content

Commit

Permalink
Add wired field to mem input (#3632)
Browse files Browse the repository at this point in the history
  • Loading branch information
danielnelson authored Jan 3, 2018
1 parent 2f7906d commit b657480
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions plugins/inputs/system/MEM_README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ For a more complete explanation of the difference between *used* and
- used (int)
- available_percent (float)
- used_percent (float)
- wired (int)

### Example Output:
```
Expand Down
1 change: 1 addition & 0 deletions plugins/inputs/system/memory.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ func (s *MemStats) Gather(acc telegraf.Accumulator) error {
"buffered": vm.Buffers,
"active": vm.Active,
"inactive": vm.Inactive,
"wired": vm.Wired,
"slab": vm.Slab,
"used_percent": 100 * float64(vm.Used) / float64(vm.Total),
"available_percent": 100 * float64(vm.Available) / float64(vm.Total),
Expand Down
3 changes: 2 additions & 1 deletion plugins/inputs/system/memory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ func TestMemStats(t *testing.T) {
Active: 8134,
Inactive: 1124,
Slab: 1234,
Wired: 134,
// Buffers: 771,
// Cached: 4312,
// Wired: 134,
// Shared: 2142,
}

Expand Down Expand Up @@ -55,6 +55,7 @@ func TestMemStats(t *testing.T) {
"buffered": uint64(0),
"active": uint64(8134),
"inactive": uint64(1124),
"wired": uint64(134),
"slab": uint64(1234),
}
acc.AssertContainsTaggedFields(t, "mem", memfields, make(map[string]string))
Expand Down

0 comments on commit b657480

Please sign in to comment.