From: Jean Flach Date: Thu, 8 Sep 2016 14:30:30 +0000 (+0200) Subject: Fix fmt-countertype in check_perfmon X-Git-Tag: v2.6.0~120 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3e7b943e36999f4eb2ded56516ed297532605e31;p=icinga2 Fix fmt-countertype in check_perfmon All three options are now working as expected fixes #10487 --- diff --git a/plugins/check_perfmon.cpp b/plugins/check_perfmon.cpp index cf0baec79..cae6aa5e0 100644 --- a/plugins/check_perfmon.cpp +++ b/plugins/check_perfmon.cpp @@ -131,13 +131,11 @@ BOOL ParseArguments(CONST INT ac, WCHAR **av, po::variables_map& vm, printInfoSt } if (vm.count("fmt-countertype")) { - if (vm["fmt-countertype"].as().compare(L"double")) - printInfo.dwRequestedType = PDH_FMT_DOUBLE; - else if (vm["fmt-countertype"].as().compare(L"int64")) + if (!vm["fmt-countertype"].as().compare(L"int64")) printInfo.dwRequestedType = PDH_FMT_LARGE; - else if (vm["fmt-countertype"].as().compare(L"long")) + else if (!vm["fmt-countertype"].as().compare(L"long")) printInfo.dwRequestedType = PDH_FMT_LONG; - else { + else if (vm["fmt-countertype"].as().compare(L"double")) { std::wcout << "Unknown value type " << vm["fmt-countertype"].as() << '\n'; return FALSE; } @@ -339,12 +337,15 @@ BOOL QueryPerfData(printInfoStruct& pI) switch (pI.dwRequestedType) { - case (PDH_FMT_LONG): + case (PDH_FMT_LONG) : pI.dValue = pDisplayValues[0].FmtValue.longValue; + break; case (PDH_FMT_LARGE) : pI.dValue = pDisplayValues[0].FmtValue.largeValue; + break; default: pI.dValue = pDisplayValues[0].FmtValue.doubleValue; + break; } delete[]pDisplayValues;