]> granicus.if.org Git - icinga2/commitdiff
Add Checkable#problem and #handled 7096/head
authorAlexander A. Klimov <alexander.klimov@icinga.com>
Tue, 9 Apr 2019 09:34:59 +0000 (11:34 +0200)
committerAlexander A. Klimov <alexander.klimov@icinga.com>
Tue, 9 Apr 2019 09:34:59 +0000 (11:34 +0200)
lib/icinga/checkable.cpp
lib/icinga/checkable.hpp
lib/icinga/checkable.ti

index 227ce4cccee15da64213205dbfaf44649bbc4b83..1fe6a3d973489c85c1a812e3c48432c27915174e 100644 (file)
@@ -144,6 +144,16 @@ bool Checkable::GetReachable() const
        return IsReachable();
 }
 
+bool Checkable::GetProblem() const
+{
+       return !IsStateOK(GetStateRaw());
+}
+
+bool Checkable::GetHandled() const
+{
+       return GetProblem() && (IsInDowntime() || IsAcknowledged());
+}
+
 void Checkable::NotifyFixedDowntimeStart(const Downtime::Ptr& downtime)
 {
        if (!downtime->GetFixed())
index 7a0623ac42e0708ba87d9f040862b341225eb4c1..44cfaad499d7381d646e6dabe77747708e808008 100644 (file)
@@ -86,6 +86,8 @@ public:
 
        int GetSeverity() const override;
        bool GetReachable() const override;
+       bool GetProblem() const override;
+       bool GetHandled() const override;
 
        /* Checks */
        intrusive_ptr<CheckCommand> GetCheckCommand() const;
index 0921f6f2f0c573aeeea2463c742fcbb06a112343..286e4b8f6b824d102c7a276db71b76e528429564 100644 (file)
@@ -126,6 +126,12 @@ abstract class Checkable : CustomVarObject
        [no_storage] bool reachable {
                get;
        };
+       [no_storage] bool problem {
+               get;
+       };
+       [no_storage] bool handled {
+               get;
+       };
 
        [state] bool force_next_check;
        [state] int acknowledgement (AcknowledgementRaw) {