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

Function printOutput

plugins/check_swap.cpp:165–199  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

163}
164
165static 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
201static int check_swap(printInfoStruct& printInfo)
202{

Callers 1

wmainFunction · 0.70

Calls 4

stateToStringFunction · 0.85
BunitStrFunction · 0.85
rendMethod · 0.80
pStringMethod · 0.80

Tested by

no test coverage detected