From 4a9650ecf5a4fd2258a686d90e3446df6c30e58a Mon Sep 17 00:00:00 2001 From: vvvkamper Date: Thu, 2 Mar 2017 19:15:33 +0700 Subject: [PATCH] Fix part 2 of #1291 added PDH_FMT_NOCAP100 format option closes #2483 --- CHANGELOG.md | 1 + plugins/inputs/win_perf_counters/pdh.go | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5773179b6..8418ffd21 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -74,6 +74,7 @@ be deprecated eventually. - [#2178](https://github.com/influxdata/telegraf/issues/2178): logparser: regexp with lookahead. - [#2466](https://github.com/influxdata/telegraf/issues/2466): Telegraf can crash in LoadDirectory on 0600 files. - [#2215](https://github.com/influxdata/telegraf/issues/2215): Iptables input: document better that rules without a comment are ignored. +- [#2483](https://github.com/influxdata/telegraf/pull/2483): Fix win_perf_counters capping values at 100. ## v1.2.1 [2017-02-01] diff --git a/plugins/inputs/win_perf_counters/pdh.go b/plugins/inputs/win_perf_counters/pdh.go index 36563d6b7..fa00e0603 100644 --- a/plugins/inputs/win_perf_counters/pdh.go +++ b/plugins/inputs/win_perf_counters/pdh.go @@ -331,7 +331,7 @@ func PdhCollectQueryData(hQuery PDH_HQUERY) uint32 { func PdhGetFormattedCounterValueDouble(hCounter PDH_HCOUNTER, lpdwType *uint32, pValue *PDH_FMT_COUNTERVALUE_DOUBLE) uint32 { ret, _, _ := pdh_GetFormattedCounterValue.Call( uintptr(hCounter), - uintptr(PDH_FMT_DOUBLE), + uintptr(PDH_FMT_DOUBLE|PDH_FMT_NOCAP100), uintptr(unsafe.Pointer(lpdwType)), uintptr(unsafe.Pointer(pValue))) @@ -378,7 +378,7 @@ func PdhGetFormattedCounterValueDouble(hCounter PDH_HCOUNTER, lpdwType *uint32, func PdhGetFormattedCounterArrayDouble(hCounter PDH_HCOUNTER, lpdwBufferSize *uint32, lpdwBufferCount *uint32, itemBuffer *PDH_FMT_COUNTERVALUE_ITEM_DOUBLE) uint32 { ret, _, _ := pdh_GetFormattedCounterArrayW.Call( uintptr(hCounter), - uintptr(PDH_FMT_DOUBLE), + uintptr(PDH_FMT_DOUBLE|PDH_FMT_NOCAP100), uintptr(unsafe.Pointer(lpdwBufferSize)), uintptr(unsafe.Pointer(lpdwBufferCount)), uintptr(unsafe.Pointer(itemBuffer)))