| 163 | } |
| 164 | |
| 165 | static int printOutput(printInfoStruct& printInfo) |
| 166 | { |
| 167 | if (l_Debug) |
| 168 | std::wcout << L"Constructing output string" << '\n'; |
| 169 | |
| 170 | state state = OK; |
| 171 | |
| 172 | std::wcout << L"SWAP "; |
| 173 | |
| 174 | double currentValue; |
| 175 | |
| 176 | if (!printInfo.showUsed) |
| 177 | currentValue = printInfo.aSwap; |
| 178 | else |
| 179 | currentValue = printInfo.tSwap - printInfo.aSwap; |
| 180 | |
| 181 | if (printInfo.warn.rend(currentValue, printInfo.tSwap)) |
| 182 | state = WARNING; |
| 183 | |
| 184 | if (printInfo.crit.rend(currentValue, printInfo.tSwap)) |
| 185 | state = CRITICAL; |
| 186 | |
| 187 | std::wcout << stateToString(state) << " - "; |
| 188 | |
| 189 | if (!printInfo.showUsed) |
| 190 | std::wcout << printInfo.percentFree << L"% free "; |
| 191 | else |
| 192 | std::wcout << 100 - printInfo.percentFree << L"% used "; |
| 193 | |
| 194 | std::wcout << "| 'swap'=" << currentValue << BunitStr(printInfo.unit) << L";" |
| 195 | << printInfo.warn.pString(printInfo.tSwap) << L";" << printInfo.crit.pString(printInfo.tSwap) |
| 196 | << L";0;" << printInfo.tSwap << '\n'; |
| 197 | |
| 198 | return state; |
| 199 | } |
| 200 | |
| 201 | static int check_swap(printInfoStruct& printInfo) |
| 202 | { |
no test coverage detected