]> granicus.if.org Git - icinga2/commitdiff
Make --perf-syntax also change short message 5733/head
authorJean Flach <jean-marcel.flach@icinga.com>
Wed, 8 Nov 2017 15:53:01 +0000 (16:53 +0100)
committerJean Flach <jean-marcel.flach@icinga.com>
Wed, 8 Nov 2017 16:05:43 +0000 (17:05 +0100)
refs #5418

plugins/check_perfmon.cpp

index fdc0d84b0bd615e9041efb44bb38ee796f01573f..d1365163bf4c76fd53bddb8ef71e44a170755b7d 100644 (file)
@@ -372,19 +372,19 @@ INT PrintOutput(CONST po::variables_map& vm, printInfoStruct& pi)
        wssPerfData << pi.dValue << ';' << pi.tWarn.pString() << ';' << pi.tCrit.pString() << ";;";
 
        if (pi.tCrit.rend(pi.dValue)) {
-               std::wcout << "PERFMON CRITICAL \"" << pi.wsFullPath << "\" = "
-                       << pi.dValue << " | " << wssPerfData.str() << '\n';
+               std::wcout << "PERFMON CRITICAL \"" << (vm.count("perf-syntax") ? vm["perf-syntax"].as<std::wstring>() : pi.wsFullPath)
+                   << "\" = " << pi.dValue << " | " << wssPerfData.str() << '\n';
                return 2;
        }
 
        if (pi.tWarn.rend(pi.dValue)) {
-               std::wcout << "PERFMON WARNING \"" << pi.wsFullPath << "\" = "
-                       << pi.dValue << " | " << wssPerfData.str() << '\n';
+               std::wcout << "PERFMON WARNING \"" << (vm.count("perf-syntax") ? vm["perf-syntax"].as<std::wstring>() : pi.wsFullPath)
+                   << "\" = " << pi.dValue << " | " << wssPerfData.str() << '\n';
                return 1;
        }
 
-       std::wcout << "PERFMON OK \"" << pi.wsFullPath << "\" = "
-               << pi.dValue << " | " << wssPerfData.str() << '\n';
+       std::wcout << "PERFMON OK \"" << (vm.count("perf-syntax") ? vm["perf-syntax"].as<std::wstring>() : pi.wsFullPath)
+           << "\" = " << pi.dValue << " | " << wssPerfData.str() << '\n';
        return 0;
 }