MCPcopy Create free account
hub / github.com/Icinga/icinga2 / printOutput

Function printOutput

plugins/check_perfmon.cpp:338–365  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

336}
337
338static int printOutput(const po::variables_map& vm, printInfoStruct& pi)
339{
340 std::wstringstream wssPerfData;
341
342 if (vm.count("perf-syntax"))
343 wssPerfData << "'" << vm["perf-syntax"].as<std::wstring>() << "'=";
344 else
345 wssPerfData << "'" << pi.wsFullPath << "'=";
346
347 wssPerfData << pi.dValue << ';' << pi.tWarn.pString() << ';' << pi.tCrit.pString() << ";;";
348
349 if (pi.tCrit.rend(pi.dValue)) {
350 std::wcout << "PERFMON CRITICAL for '" << (vm.count("perf-syntax") ? vm["perf-syntax"].as<std::wstring>() : pi.wsFullPath)
351 << "' = " << pi.dValue << " | " << wssPerfData.str() << "\n";
352 return 2;
353 }
354
355 if (pi.tWarn.rend(pi.dValue)) {
356 std::wcout << "PERFMON WARNING for '" << (vm.count("perf-syntax") ? vm["perf-syntax"].as<std::wstring>() : pi.wsFullPath)
357 << "' = " << pi.dValue << " | " << wssPerfData.str() << "\n";
358 return 1;
359 }
360
361 std::wcout << "PERFMON OK for '" << (vm.count("perf-syntax") ? vm["perf-syntax"].as<std::wstring>() : pi.wsFullPath)
362 << "' = " << pi.dValue << " | " << wssPerfData.str() << "\n";
363
364 return 0;
365}
366
367int wmain(int argc, WCHAR **argv)
368{

Callers 1

wmainFunction · 0.70

Calls 3

countMethod · 0.80
pStringMethod · 0.80
rendMethod · 0.80

Tested by

no test coverage detected