mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-07 05:44:28 +02:00
Fix check_swap percentage calculation
This fixes the check_swap percentage calculation. When the pagefile is turned off the available swap and total swap are 0 which leads to a wrong calculation and misformated output. refs #6913
This commit is contained in:
parent
e555b2fa6d
commit
4961e9ba62
@ -229,7 +229,10 @@ static int check_swap(printInfoStruct& printInfo)
|
|||||||
printInfo.aSwap += round(pageFiles.at(i).availableSpwap / pow(1024.0, printInfo.unit));
|
printInfo.aSwap += round(pageFiles.at(i).availableSpwap / pow(1024.0, printInfo.unit));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (printInfo.aSwap > 0 && printInfo.tSwap > 0)
|
||||||
printInfo.percentFree = 100.0 * printInfo.aSwap / printInfo.tSwap;
|
printInfo.percentFree = 100.0 * printInfo.aSwap / printInfo.tSwap;
|
||||||
|
else
|
||||||
|
printInfo.percentFree = 0;
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user