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

Function printOutput

plugins/check_memory.cpp:146–180  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

144}
145
146static int printOutput(printInfoStruct& printInfo)
147{
148 if (l_Debug)
149 std::wcout << L"Constructing output string" << '\n';
150
151 state state = OK;
152
153 std::wcout << L"MEMORY ";
154
155 double currentValue;
156
157 if (!printInfo.showUsed)
158 currentValue = printInfo.aRam;
159 else
160 currentValue = printInfo.tRam - printInfo.aRam;
161
162 if (printInfo.warn.rend(currentValue, printInfo.tRam))
163 state = WARNING;
164
165 if (printInfo.crit.rend(currentValue, printInfo.tRam))
166 state = CRITICAL;
167
168 std::wcout << stateToString(state);
169
170 if (!printInfo.showUsed)
171 std::wcout << " - " << printInfo.percentFree << L"% free";
172 else
173 std::wcout << " - " << 100 - printInfo.percentFree << L"% used";
174
175 std::wcout << "| 'memory'=" << currentValue << BunitStr(printInfo.unit) << L";"
176 << printInfo.warn.pString(printInfo.tRam) << L";" << printInfo.crit.pString(printInfo.tRam)
177 << L";0;" << printInfo.tRam << '\n';
178
179 return state;
180}
181
182static int check_memory(printInfoStruct& printInfo)
183{

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