From: Michael Insel Date: Mon, 26 Nov 2018 16:13:58 +0000 (+0100) Subject: Fix check_perfmon to support non-localized names X-Git-Tag: v2.10.4~1 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=60bc79ffa2daed3c8b1fe53d02e126710cc45562;p=icinga2 Fix check_perfmon to support non-localized names This fixes check_perfmon to support non-localized names on localized Windows machines. The fix handles the given performance counter by default as non-localized name, if none is found it falls back to the localized name. refs #5546 (cherry picked from commit 5da4fbde3b501c174ec028b7a7ae036194a5a77e) --- diff --git a/plugins/check_perfmon.cpp b/plugins/check_perfmon.cpp index e9d44cf55..bfe883b2d 100644 --- a/plugins/check_perfmon.cpp +++ b/plugins/check_perfmon.cpp @@ -297,7 +297,11 @@ bool QueryPerfData(printInfoStruct& pI) if (FAILED(status)) goto die; - status = PdhAddCounter(hQuery, pI.wsFullPath.c_str(), NULL, &hCounter); + status = PdhAddEnglishCounter(hQuery, pI.wsFullPath.c_str(), NULL, &hCounter); + + if (FAILED(status)) + status = PdhAddCounter(hQuery, pI.wsFullPath.c_str(), NULL, &hCounter); + if (FAILED(status)) goto die;