Skip to content

Commit

Permalink
Adding active & inactive memory to mem plugin
Browse files Browse the repository at this point in the history
closes #1213
  • Loading branch information
sparrc committed Jun 1, 2016
1 parent 7921d87 commit f3341a3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 2 additions & 0 deletions plugins/inputs/system/memory.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ func (s *MemStats) Gather(acc telegraf.Accumulator) error {
"free": vm.Free,
"cached": vm.Cached,
"buffered": vm.Buffers,
"active": vm.Active,
"inactive": vm.Inactive,
"used_percent": 100 * float64(vm.Used) / float64(vm.Total),
"available_percent": 100 * float64(vm.Available) / float64(vm.Total),
}
Expand Down
6 changes: 4 additions & 2 deletions plugins/inputs/system/memory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ func TestMemStats(t *testing.T) {
Available: 7600,
Used: 5000,
Free: 1235,
// Active: 8134,
// Inactive: 1124,
Active: 8134,
Inactive: 1124,
// Buffers: 771,
// Cached: 4312,
// Wired: 134,
Expand Down Expand Up @@ -52,6 +52,8 @@ func TestMemStats(t *testing.T) {
"free": uint64(1235),
"cached": uint64(0),
"buffered": uint64(0),
"active": uint64(8134),
"inactive": uint64(1124),
}
acc.AssertContainsTaggedFields(t, "mem", memfields, make(map[string]string))

Expand Down

0 comments on commit f3341a3

Please sign in to comment.