| 128 | } |
| 129 | |
| 130 | static int printOutput(const int numProcs, printInfoStruct& printInfo) |
| 131 | { |
| 132 | if (l_Debug) |
| 133 | std::wcout << L"Constructing output string" << '\n'; |
| 134 | |
| 135 | state state = OK; |
| 136 | |
| 137 | if (printInfo.warn.rend(numProcs)) |
| 138 | state = WARNING; |
| 139 | |
| 140 | if (printInfo.crit.rend(numProcs)) |
| 141 | state = CRITICAL; |
| 142 | |
| 143 | std::wstring user; |
| 144 | if (!printInfo.user.empty()) |
| 145 | user = L" processes of user " + printInfo.user; |
| 146 | |
| 147 | std::wcout << L"PROCS "; |
| 148 | |
| 149 | switch (state) { |
| 150 | case OK: |
| 151 | std::wcout << L"OK"; |
| 152 | break; |
| 153 | case WARNING: |
| 154 | std::wcout << L"WARNING"; |
| 155 | break; |
| 156 | case CRITICAL: |
| 157 | std::wcout << L"CRITICAL"; |
| 158 | break; |
| 159 | } |
| 160 | |
| 161 | std::wcout << L" " << numProcs << user << L" | procs=" << numProcs << L";" |
| 162 | << printInfo.warn.pString() << L";" << printInfo.crit.pString() << L";0;" << '\n'; |
| 163 | |
| 164 | return state; |
| 165 | } |
| 166 | |
| 167 | static int countProcs() |
| 168 | { |