"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "lib/icinga/host.cpp" between
icinga2-2.11.5.tar.gz and icinga2-2.12.0.tar.gz

About: Icinga 2 is an enterprise grade monitoring system which keeps watch over networks and any conceivable network resource.

host.cpp  (icinga2-2.11.5):host.cpp  (icinga2-2.12.0)
skipping to change at line 167 skipping to change at line 167
HostState Host::GetLastState() const HostState Host::GetLastState() const
{ {
return CalculateState(GetLastStateRaw()); return CalculateState(GetLastStateRaw());
} }
HostState Host::GetLastHardState() const HostState Host::GetLastHardState() const
{ {
return CalculateState(GetLastHardStateRaw()); return CalculateState(GetLastHardStateRaw());
} }
/* keep in sync with Service::GetSeverity() */ /* 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. */
int Host::GetSeverity() const int Host::GetSeverity() const
{ {
int severity = 0; int severity = 0;
ObjectLock olock(this); ObjectLock olock(this);
ServiceState state = GetStateRaw(); HostState state = GetState();
/* OK/Warning = Up, Critical/Unknownb = Down */ if (!HasBeenChecked()) {
if (!HasBeenChecked()) severity = 16;
severity |= SeverityFlagPending; } else if (state == HostUp) {
else if (state == ServiceUnknown) severity = 0;
severity |= SeverityFlagCritical; } else {
else if (state == ServiceCritical) if (IsReachable())
severity |= SeverityFlagCritical; severity = 64;
else
if (IsInDowntime()) severity = 32;
severity |= SeverityFlagDowntime;
else if (IsAcknowledged()) if (IsAcknowledged())
severity |= SeverityFlagAcknowledgement; severity += 512;
else else if (IsInDowntime())
severity |= SeverityFlagUnhandled; severity += 256;
else
severity += 2048;
}
olock.Unlock(); olock.Unlock();
return severity; return severity;
} }
bool Host::IsStateOK(ServiceState state) const bool Host::IsStateOK(ServiceState state) const
{ {
return Host::CalculateState(state) == HostUp; return Host::CalculateState(state) == HostUp;
} }
void Host::SaveLastState(ServiceState state, double timestamp) void Host::SaveLastState(ServiceState state, double timestamp)
{ {
if (state == ServiceOK || state == ServiceWarning) if (state == ServiceOK || state == ServiceWarning)
 End of changes. 4 change blocks. 
16 lines changed or deleted 23 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)