Allow 64bit integers in kernel_vmstat

This commit is contained in:
Daniel Nelson 2017-09-25 14:51:13 -07:00 committed by Daniel Nelson
parent ffb04761d2
commit 3398c43c75
2 changed files with 3 additions and 3 deletions

View File

@ -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. // We only want the even number index as that contain the stat name.
if i%2 == 0 { if i%2 == 0 {
// Convert the stat value into an integer. // 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 { if err != nil {
return err return err
} }

View File

@ -48,7 +48,7 @@ func TestFullVmStatProcFile(t *testing.T) {
"nr_isolated_anon": int64(0), "nr_isolated_anon": int64(0),
"nr_isolated_file": int64(0), "nr_isolated_file": int64(0),
"nr_shmem": int64(541689), "nr_shmem": int64(541689),
"numa_hit": int64(5113399878), "numa_hit": int64(6690743595),
"numa_miss": int64(0), "numa_miss": int64(0),
"numa_foreign": int64(0), "numa_foreign": int64(0),
"numa_interleave": int64(35793), "numa_interleave": int64(35793),
@ -200,7 +200,7 @@ nr_writeback_temp 0
nr_isolated_anon 0 nr_isolated_anon 0
nr_isolated_file 0 nr_isolated_file 0
nr_shmem 541689 nr_shmem 541689
numa_hit 5113399878 numa_hit 6690743595
numa_miss 0 numa_miss 0
numa_foreign 0 numa_foreign 0
numa_interleave 35793 numa_interleave 35793