std::wcout << L"Constructing output string" << '\n';
state state = OK;
- double fswap = ((double)printInfo.aRam / (double)printInfo.tRam) * 100.0;
if (printInfo.warn.rend(printInfo.aRam, printInfo.tRam))
state = WARNING;
switch (state) {
case OK:
- std::wcout << L"MEMORY OK - " << fswap << L"% free | memory=" << printInfo.aRam << BunitStr(printInfo.unit) << L";"
+ std::wcout << L"MEMORY OK - " << printInfo.percentFree << L"% free | memory=" << printInfo.aRam << BunitStr(printInfo.unit) << L";"
<< printInfo.warn.pString(printInfo.tRam) << L";" << printInfo.crit.pString(printInfo.tRam)
<< L";0;" << printInfo.tRam << '\n';
break;
case WARNING:
- std::wcout << L"MEMORY WARNING - " << fswap << L"% free | memory=" << printInfo.aRam << BunitStr(printInfo.unit) << L";"
+ std::wcout << L"MEMORY WARNING - " << printInfo.percentFree << L"% free | memory=" << printInfo.aRam << BunitStr(printInfo.unit) << L";"
<< printInfo.warn.pString(printInfo.tRam) << L";" << printInfo.crit.pString(printInfo.tRam)
<< L";0;" << printInfo.tRam << '\n';
break;
case CRITICAL:
- std::wcout << L"MEMORY CRITICAL - " << fswap << L"% free | memory=" << printInfo.aRam << BunitStr(printInfo.unit) << L";"
+ std::wcout << L"MEMORY CRITICAL - " << printInfo.percentFree << L"% free | memory=" << printInfo.aRam << BunitStr(printInfo.unit) << L";"
<< printInfo.warn.pString(printInfo.tRam) << L";" << printInfo.crit.pString(printInfo.tRam)
<< L";0;" << printInfo.tRam << '\n';
break;
printInfo.tRam = round(pMemBuf->ullTotalPhys / pow(1024.0, printInfo.unit));
printInfo.aRam = round(pMemBuf->ullAvailPhys / pow(1024.0, printInfo.unit));
+ printInfo.percentFree = 100.0 * pMemBuf->ullAvailPhys / pMemBuf->ullTotalPhys;
if (debug)
std::wcout << L"Found pMemBuf->dwTotalPhys: " << pMemBuf->ullTotalPhys << '\n'
std::wcout << L"Constructing output string" << '\n';
state state = OK;
- double fswap = ((double)printInfo.aSwap / (double)printInfo.tSwap) * 100.0;
if (printInfo.warn.rend(printInfo.aSwap, printInfo.tSwap))
state = WARNING;
switch (state) {
case OK:
- std::wcout << L"SWAP OK - " << fswap << L"% free | swap=" << printInfo.aSwap << BunitStr(printInfo.unit) << L";"
+ std::wcout << L"SWAP OK - " << printInfo.percentFree << L"% free | swap=" << printInfo.aSwap << BunitStr(printInfo.unit) << L";"
<< printInfo.warn.pString(printInfo.tSwap) << L";" << printInfo.crit.pString(printInfo.tSwap)
<< L";0;" << printInfo.tSwap << '\n';
break;
case WARNING:
- std::wcout << L"SWAP WARNING - " << fswap << L"% free | swap=" << printInfo.aSwap << BunitStr(printInfo.unit) << L";"
+ std::wcout << L"SWAP WARNING - " << printInfo.percentFree << L"% free | swap=" << printInfo.aSwap << BunitStr(printInfo.unit) << L";"
<< printInfo.warn.pString(printInfo.tSwap) << L";" << printInfo.crit.pString(printInfo.tSwap)
<< L";0;" << printInfo.tSwap << '\n';
break;
case CRITICAL:
- std::wcout << L"SWAP CRITICAL - " << fswap << L"% free | swap=" << printInfo.aSwap << BunitStr(printInfo.unit) << L";"
+ std::wcout << L"SWAP CRITICAL - " << printInfo.percentFree << L"% free | swap=" << printInfo.aSwap << BunitStr(printInfo.unit) << L";"
<< printInfo.warn.pString(printInfo.tSwap) << L";" << printInfo.crit.pString(printInfo.tSwap)
<< L";0;" << printInfo.tSwap << '\n';
break;
printInfo.tSwap = round(MemBuf.ullTotalPageFile / pow(1024.0, printInfo.unit));
printInfo.aSwap = round(MemBuf.ullAvailPageFile / pow(1024.0, printInfo.unit));
+ printInfo.percentFree = 100.0 * MemBuf.ullAvailPageFile / MemBuf.ullTotalPageFile;
return -1;
}