Merge pull request #7112 from Icinga/bugfix/service-handled

Include host state in Service#handled and Service#severity
This commit is contained in:
Michael Friedrich 2019-04-17 13:16:23 +02:00 committed by GitHub
commit 3665430005
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 0 deletions

View File

@ -45,6 +45,7 @@ enum SeverityFlag
{
SeverityFlagDowntime = 1,
SeverityFlagAcknowledgement = 2,
SeverityFlagHostDown = 4,
SeverityFlagUnhandled = 8,
SeverityFlagPending = 16,
SeverityFlagWarning = 32,

View File

@ -125,6 +125,8 @@ int Service::GetSeverity() const
severity |= SeverityFlagDowntime;
else if (IsAcknowledged())
severity |= SeverityFlagAcknowledgement;
else if (m_Host->GetProblem())
severity |= SeverityFlagHostDown;
else
severity |= SeverityFlagUnhandled;
@ -133,6 +135,11 @@ int Service::GetSeverity() const
return severity;
}
bool Service::GetHandled() const
{
return Checkable::GetHandled() || m_Host->GetProblem();
}
bool Service::IsStateOK(ServiceState state) const
{
return state == ServiceOK;

View File

@ -29,6 +29,7 @@ public:
Host::Ptr GetHost() const override;
int GetSeverity() const override;
bool GetHandled() const override;
bool ResolveMacro(const String& macro, const CheckResult::Ptr& cr, Value *result) const override;