From ae18536b0f20dbe05448f2407f128a9b8bf324fe Mon Sep 17 00:00:00 2001 From: "Alexander A. Klimov" Date: Thu, 11 Apr 2019 11:25:45 +0200 Subject: [PATCH 1/2] Service: be handled while host is down --- lib/icinga/service.cpp | 5 +++++ lib/icinga/service.hpp | 1 + 2 files changed, 6 insertions(+) diff --git a/lib/icinga/service.cpp b/lib/icinga/service.cpp index 0b52298f5..99a479647 100644 --- a/lib/icinga/service.cpp +++ b/lib/icinga/service.cpp @@ -133,6 +133,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; diff --git a/lib/icinga/service.hpp b/lib/icinga/service.hpp index 8453e8506..0e6e4d8d3 100644 --- a/lib/icinga/service.hpp +++ b/lib/icinga/service.hpp @@ -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; From 66949dd01868518854341d5615c86ac33930f322 Mon Sep 17 00:00:00 2001 From: "Alexander A. Klimov" Date: Thu, 11 Apr 2019 11:36:23 +0200 Subject: [PATCH 2/2] Service: reduce severity while host is down --- lib/icinga/checkable.hpp | 1 + lib/icinga/service.cpp | 2 ++ 2 files changed, 3 insertions(+) diff --git a/lib/icinga/checkable.hpp b/lib/icinga/checkable.hpp index 44cfaad49..0c436f0e1 100644 --- a/lib/icinga/checkable.hpp +++ b/lib/icinga/checkable.hpp @@ -45,6 +45,7 @@ enum SeverityFlag { SeverityFlagDowntime = 1, SeverityFlagAcknowledgement = 2, + SeverityFlagHostDown = 4, SeverityFlagUnhandled = 8, SeverityFlagPending = 16, SeverityFlagWarning = 32, diff --git a/lib/icinga/service.cpp b/lib/icinga/service.cpp index 99a479647..58531c975 100644 --- a/lib/icinga/service.cpp +++ b/lib/icinga/service.cpp @@ -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;