]> granicus.if.org Git - icinga2/blobdiff - lib/icinga/checkable.hpp
Merge pull request #6727 from Icinga/feature/cluster-config-sync-stage
[icinga2] / lib / icinga / checkable.hpp
index b2061be299cc74cebc7bb282f129384f7d07d1df..fcfb3f74bdbee0ef1cf36ff5cda682bbd5edbdd2 100644 (file)
@@ -1,27 +1,10 @@
-/******************************************************************************
- * Icinga 2                                                                   *
- * Copyright (C) 2012-2018 Icinga Development Team (https://www.icinga.com/)  *
- *                                                                            *
- * This program is free software; you can redistribute it and/or              *
- * modify it under the terms of the GNU General Public License                *
- * as published by the Free Software Foundation; either version 2             *
- * of the License, or (at your option) any later version.                     *
- *                                                                            *
- * This program is distributed in the hope that it will be useful,            *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of             *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              *
- * GNU General Public License for more details.                               *
- *                                                                            *
- * You should have received a copy of the GNU General Public License          *
- * along with this program; if not, write to the Free Software Foundation     *
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.             *
- ******************************************************************************/
+/* Icinga 2 | (c) 2012 Icinga GmbH | GPLv2+ */
 
 #ifndef CHECKABLE_H
 #define CHECKABLE_H
 
 #include "icinga/i2-icinga.hpp"
-#include "icinga/checkable.thpp"
+#include "icinga/checkable-ti.hpp"
 #include "icinga/timeperiod.hpp"
 #include "icinga/notification.hpp"
 #include "icinga/comment.hpp"
@@ -62,6 +45,7 @@ enum SeverityFlag
 {
        SeverityFlagDowntime = 1,
        SeverityFlagAcknowledgement = 2,
+       SeverityFlagHostDown = 4,
        SeverityFlagUnhandled = 8,
        SeverityFlagPending = 16,
        SeverityFlagWarning = 32,
@@ -102,6 +86,8 @@ public:
        void ClearAcknowledgement(const MessageOrigin::Ptr& origin = nullptr);
 
        int GetSeverity() const override;
+       bool GetProblem() const override;
+       bool GetHandled() const override;
 
        /* Checks */
        intrusive_ptr<CheckCommand> GetCheckCommand() const;
@@ -113,7 +99,7 @@ public:
        void UpdateNextCheck(const MessageOrigin::Ptr& origin = nullptr);
 
        bool HasBeenChecked() const;
-       virtual bool IsStateOK(ServiceState state) = 0;
+       virtual bool IsStateOK(ServiceState state) const = 0;
 
        double GetLastCheck() const final;
 
@@ -133,8 +119,8 @@ public:
        static boost::signals2::signal<void (const Checkable::Ptr&, NotificationType, const CheckResult::Ptr&,
                const String&, const String&, const MessageOrigin::Ptr&)> OnNotificationsRequested;
        static boost::signals2::signal<void (const Notification::Ptr&, const Checkable::Ptr&, const User::Ptr&,
-               const NotificationType&, const CheckResult::Ptr&, const String&, const String&, const String&,
-               const MessageOrigin::Ptr&)> OnNotificationSentToUser;
+               const NotificationType&, const CheckResult::Ptr&, const NotificationResult::Ptr&, const String&,
+               const String&, const String&, const MessageOrigin::Ptr&)> OnNotificationSentToUser;
        static boost::signals2::signal<void (const Notification::Ptr&, const Checkable::Ptr&, const std::set<User::Ptr>&,
                const NotificationType&, const CheckResult::Ptr&, const String&,
                const String&, const MessageOrigin::Ptr&)> OnNotificationSentToAllUsers;
@@ -191,12 +177,14 @@ public:
        void RemoveReverseDependency(const intrusive_ptr<Dependency>& dep);
        std::vector<intrusive_ptr<Dependency> > GetReverseDependencies() const;
 
-       void ValidateCheckInterval(double value, const ValidationUtils& utils) final;
-       void ValidateMaxCheckAttempts(int value, const ValidationUtils& utils) final;
+       void ValidateCheckInterval(const Lazy<double>& lvalue, const ValidationUtils& value) final;
+       void ValidateRetryInterval(const Lazy<double>& lvalue, const ValidationUtils& value) final;
+       void ValidateMaxCheckAttempts(const Lazy<int>& lvalue, const ValidationUtils& value) final;
 
        static void IncreasePendingChecks();
        static void DecreasePendingChecks();
        static int GetPendingChecks();
+       static void AquirePendingCheckSlot(int maxPendingChecks);
 
        static Object::Ptr GetPrototype();
 
@@ -211,6 +199,7 @@ private:
 
        static boost::mutex m_StatsMutex;
        static int m_PendingChecks;
+       static boost::condition_variable m_PendingChecksCV;
 
        /* Downtimes */
        std::set<Downtime::Ptr> m_Downtimes;