From 52b9fc837c599ba04abcb3e8d38188cfffb7bee5 Mon Sep 17 00:00:00 2001 From: Cameron Sparr Date: Wed, 1 Jun 2016 15:32:47 +0100 Subject: [PATCH] Adding active & inactive memory to mem plugin closes #1213 --- CHANGELOG.md | 1 + plugins/inputs/system/memory.go | 2 ++ plugins/inputs/system/memory_test.go | 6 ++++-- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 90332b881..9f9caaa07 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -36,6 +36,7 @@ time before a new metric is included by the plugin. - [#1197](https://github.com/influxdata/telegraf/pull/1197): Limit AWS GetMetricStatistics requests to 10 per second. - [#1278](https://github.com/influxdata/telegraf/pull/1278) & [#1288](https://github.com/influxdata/telegraf/pull/1288) & [#1295](https://github.com/influxdata/telegraf/pull/1295): RabbitMQ/Apache/InfluxDB inputs: made url(s) parameter optional by using reasonable input defaults if not specified - [#1296](https://github.com/influxdata/telegraf/issues/1296): Refactor of flush_jitter argument. +- [#1213](https://github.com/influxdata/telegraf/issues/1213): Add inactive & active memory to mem plugin. ### Bugfixes diff --git a/plugins/inputs/system/memory.go b/plugins/inputs/system/memory.go index 82ce9c9c8..c6dbff45e 100644 --- a/plugins/inputs/system/memory.go +++ b/plugins/inputs/system/memory.go @@ -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), } diff --git a/plugins/inputs/system/memory_test.go b/plugins/inputs/system/memory_test.go index a7f7905f9..1fced6918 100644 --- a/plugins/inputs/system/memory_test.go +++ b/plugins/inputs/system/memory_test.go @@ -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, @@ -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))