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

Function printOutput

plugins/check_uptime.cpp:140–171  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

138}
139
140static int printOutput(printInfoStruct& printInfo)
141{
142 if (l_Debug)
143 std::wcout << L"Constructing output string" << '\n';
144
145 state state = OK;
146
147 if (printInfo.warn.rend((double) printInfo.time))
148 state = WARNING;
149 if (printInfo.crit.rend((double) printInfo.time))
150 state = CRITICAL;
151
152 switch (state) {
153 case OK:
154 std::wcout << L"UPTIME OK " << printInfo.time << TunitStr(printInfo.unit) << L" | 'uptime'=" << printInfo.timeInSeconds
155 << "s" << L";" << printInfo.warn.toSeconds(printInfo.unit).pString() << L";"
156 << printInfo.crit.toSeconds(printInfo.unit).pString() << L";0;" << '\n';
157 break;
158 case WARNING:
159 std::wcout << L"UPTIME WARNING " << printInfo.time << TunitStr(printInfo.unit) << L" | 'uptime'=" << printInfo.timeInSeconds
160 << "s" << L";" << printInfo.warn.toSeconds(printInfo.unit).pString() << L";"
161 << printInfo.crit.toSeconds(printInfo.unit).pString() << L";0;" << '\n';
162 break;
163 case CRITICAL:
164 std::wcout << L"UPTIME CRITICAL " << printInfo.time << TunitStr(printInfo.unit) << L" | 'uptime'=" << printInfo.timeInSeconds
165 << "s" << L";" << printInfo.warn.toSeconds(printInfo.unit).pString() << L";"
166 << printInfo.crit.toSeconds(printInfo.unit).pString() << L";0;" << '\n';
167 break;
168 }
169
170 return state;
171}
172
173static void getUptime(printInfoStruct& printInfo)
174{

Callers 1

wmainFunction · 0.70

Calls 4

TunitStrFunction · 0.85
rendMethod · 0.80
pStringMethod · 0.80
toSecondsMethod · 0.80

Tested by

no test coverage detected