From 3398c43c752af6476e408b30386154fd3bf6fa49 Mon Sep 17 00:00:00 2001 From: Daniel Nelson Date: Mon, 25 Sep 2017 14:51:13 -0700 Subject: [PATCH] Allow 64bit integers in kernel_vmstat --- plugins/inputs/system/kernel_vmstat.go | 2 +- plugins/inputs/system/kernel_vmstat_test.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/inputs/system/kernel_vmstat.go b/plugins/inputs/system/kernel_vmstat.go index 93c822789..197d81185 100644 --- a/plugins/inputs/system/kernel_vmstat.go +++ b/plugins/inputs/system/kernel_vmstat.go @@ -41,7 +41,7 @@ func (k *KernelVmstat) Gather(acc telegraf.Accumulator) error { // We only want the even number index as that contain the stat name. if i%2 == 0 { // Convert the stat value into an integer. - m, err := strconv.Atoi(string(dataFields[i+1])) + m, err := strconv.ParseInt(string(dataFields[i+1]), 10, 64) if err != nil { return err } diff --git a/plugins/inputs/system/kernel_vmstat_test.go b/plugins/inputs/system/kernel_vmstat_test.go index 963cf7f4a..ed0c03e28 100644 --- a/plugins/inputs/system/kernel_vmstat_test.go +++ b/plugins/inputs/system/kernel_vmstat_test.go @@ -48,7 +48,7 @@ func TestFullVmStatProcFile(t *testing.T) { "nr_isolated_anon": int64(0), "nr_isolated_file": int64(0), "nr_shmem": int64(541689), - "numa_hit": int64(5113399878), + "numa_hit": int64(6690743595), "numa_miss": int64(0), "numa_foreign": int64(0), "numa_interleave": int64(35793), @@ -200,7 +200,7 @@ nr_writeback_temp 0 nr_isolated_anon 0 nr_isolated_file 0 nr_shmem 541689 -numa_hit 5113399878 +numa_hit 6690743595 numa_miss 0 numa_foreign 0 numa_interleave 35793