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

Method GetSeverity

lib/icinga/host.cpp:171–196  ·  view source on GitHub ↗

keep in sync with Service::GetSeverity() * One could think it may be smart to use an enum and some bitmask math here. * But the only thing the consuming icingaweb2 cares about is being able to * sort by severity. It is therefore easier to keep them seperated here. */

Source from the content-addressed store, hash-verified

169 * But the only thing the consuming icingaweb2 cares about is being able to
170 * sort by severity. It is therefore easier to keep them seperated here. */
171int Host::GetSeverity() const
172{
173 ObjectLock olock(this);
174 HostState state = GetState();
175
176 if (!HasBeenChecked()) {
177 return 16;
178 }
179 if (state == HostUp) {
180 return 0;
181 }
182
183 int severity = 32; // DOWN
184
185 if (IsAcknowledged()) {
186 severity += 512;
187 } else if (IsInDowntime()) {
188 severity += 256;
189 } else if (!IsReachable()) {
190 severity += 1024;
191 } else {
192 severity += 2048;
193 }
194
195 return severity;
196}
197
198bool Host::IsStateOK(ServiceState state) const
199{

Callers 1

SerializeStateMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected