From b900967b787f52d2f7e872ff3b3ecffb6585fd8e Mon Sep 17 00:00:00 2001
From: Daniel Nelson <daniel@wavesofdawn.com>
Date: Tue, 2 Jan 2018 16:37:11 -0800
Subject: [PATCH] Add wired field to mem input (#3632)

---
 plugins/inputs/system/MEM_README.md  | 1 +
 plugins/inputs/system/memory.go      | 1 +
 plugins/inputs/system/memory_test.go | 3 ++-
 3 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/plugins/inputs/system/MEM_README.md b/plugins/inputs/system/MEM_README.md
index 72869f67..8a9ff823 100644
--- a/plugins/inputs/system/MEM_README.md
+++ b/plugins/inputs/system/MEM_README.md
@@ -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:
 ```
diff --git a/plugins/inputs/system/memory.go b/plugins/inputs/system/memory.go
index 31388b4c..490c56f8 100644
--- a/plugins/inputs/system/memory.go
+++ b/plugins/inputs/system/memory.go
@@ -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),
diff --git a/plugins/inputs/system/memory_test.go b/plugins/inputs/system/memory_test.go
index 336de95f..5d5860a8 100644
--- a/plugins/inputs/system/memory_test.go
+++ b/plugins/inputs/system/memory_test.go
@@ -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,
 	}
 
@@ -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))
-- 
GitLab