From 065ec8749e3103720ce72ec003810f4e98e4c2fa Mon Sep 17 00:00:00 2001 From: Oskar Date: Wed, 22 Mar 2017 20:04:58 +0100 Subject: [PATCH] Multi instances in win_perf_counters (#2352) --- CHANGELOG.md | 2 ++ plugins/inputs/win_perf_counters/win_perf_counters.go | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5ef7f580b0565..fd1ec5136be86 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -82,6 +82,8 @@ be deprecated eventually. - [#2520](https://github.com/influxdata/telegraf/pull/2520): Update default value for Cloudwatch rate limit - [#2513](https://github.com/influxdata/telegraf/issues/2513): create /etc/telegraf/telegraf.d directory in tarball. - [#2541](https://github.com/influxdata/telegraf/issues/2541): Return error on unsupported serializer data format. +- [#1827](https://github.com/influxdata/telegraf/issues/1827): Fix Windows Performance Counters multi instance identifier + ## v1.2.1 [2017-02-01] diff --git a/plugins/inputs/win_perf_counters/win_perf_counters.go b/plugins/inputs/win_perf_counters/win_perf_counters.go index da59c3040266f..5365dc68bb043 100644 --- a/plugins/inputs/win_perf_counters/win_perf_counters.go +++ b/plugins/inputs/win_perf_counters/win_perf_counters.go @@ -265,6 +265,11 @@ func (m *Win_PerfCounters) Gather(acc telegraf.Accumulator) error { } else if metric.instance == s { // Catch if we set it to total or some form of it add = true + } else if strings.Contains(metric.instance, "#") && strings.HasPrefix(metric.instance, s) { + // If you are using a multiple instance identifier such as "w3wp#1" + // phd.dll returns only the first 2 characters of the identifier. + add = true + s = metric.instance } else if metric.instance == "------" { add = true }