]> granicus.if.org Git - icinga2/blobdiff - lib/icinga/clusterevents.hpp
Merge pull request #6727 from Icinga/feature/cluster-config-sync-stage
[icinga2] / lib / icinga / clusterevents.hpp
index a03f0b2db37a24adfe00e50c6b1206dd769589a7..144155cc544afdcc41c83fd9a83e8dfd3206bbb5 100644 (file)
@@ -1,21 +1,4 @@
-/******************************************************************************
- * Icinga 2                                                                   *
- * Copyright (C) 2012-2016 Icinga Development Team (https://www.icinga.org/)  *
- *                                                                            *
- * 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 CLUSTEREVENTS_H
 #define CLUSTEREVENTS_H
@@ -32,10 +15,10 @@ namespace icinga
 /**
  * @ingroup icinga
  */
-class I2_ICINGA_API ClusterEvents
+class ClusterEvents
 {
 public:
-       static void StaticInitialize(void);
+       static void StaticInitialize();
 
        static void CheckResultHandler(const Checkable::Ptr& checkable, const CheckResult::Ptr& cr, const MessageOrigin::Ptr& origin);
        static Value CheckResultAPIHandler(const MessageOrigin::Ptr& origin, const Dictionary::Ptr& params);
@@ -53,7 +36,7 @@ public:
        static Value ForceNextNotificationChangedAPIHandler(const MessageOrigin::Ptr& origin, const Dictionary::Ptr& params);
 
        static void AcknowledgementSetHandler(const Checkable::Ptr& checkable, const String& author, const String& comment, AcknowledgementType type,
-           bool notify, double expiry, const MessageOrigin::Ptr& origin);
+               bool notify, bool persistent, double expiry, const MessageOrigin::Ptr& origin);
        static Value AcknowledgementSetAPIHandler(const MessageOrigin::Ptr& origin, const Dictionary::Ptr& params);
 
        static void AcknowledgementClearedHandler(const Checkable::Ptr& checkable, const MessageOrigin::Ptr& origin);
@@ -61,23 +44,35 @@ public:
 
        static Value ExecuteCommandAPIHandler(const MessageOrigin::Ptr& origin, const Dictionary::Ptr& params);
 
-       static String GetRepositoryDir(void);
-       static void RepositoryTimerHandler(void);
-       static Value UpdateRepositoryAPIHandler(const MessageOrigin::Ptr& origin, const Dictionary::Ptr& params);
-
        static Dictionary::Ptr MakeCheckResultMessage(const Checkable::Ptr& checkable, const CheckResult::Ptr& cr);
 
        static void SendNotificationsHandler(const Checkable::Ptr& checkable, NotificationType type,
-           const CheckResult::Ptr& cr, const String& author, const String& text, const MessageOrigin::Ptr& origin);
+               const CheckResult::Ptr& cr, const String& author, const String& text, const MessageOrigin::Ptr& origin);
        static Value SendNotificationsAPIHandler(const MessageOrigin::Ptr& origin, const Dictionary::Ptr& params);
 
        static void NotificationSentUserHandler(const Notification::Ptr& notification, const Checkable::Ptr& checkable, const User::Ptr& user,
-           NotificationType notificationType, const CheckResult::Ptr& cr, const String& author, const String& commentText, const String& command, const MessageOrigin::Ptr& origin);
+               NotificationType notificationType, const CheckResult::Ptr& cr, const NotificationResult::Ptr& nr,
+               const String& author, const String& commentText, const String& command, const MessageOrigin::Ptr& origin);
        static Value NotificationSentUserAPIHandler(const MessageOrigin::Ptr& origin, const Dictionary::Ptr& params);
 
        static void NotificationSentToAllUsersHandler(const Notification::Ptr& notification, const Checkable::Ptr& checkable, const std::set<User::Ptr>& users,
-           NotificationType notificationType, const CheckResult::Ptr& cr, const String& author, const String& commentText, const MessageOrigin::Ptr& origin);
+               NotificationType notificationType, const CheckResult::Ptr& cr, const String& author, const String& commentText, const MessageOrigin::Ptr& origin);
        static Value NotificationSentToAllUsersAPIHandler(const MessageOrigin::Ptr& origin, const Dictionary::Ptr& params);
+
+       static int GetCheckRequestQueueSize();
+       static void LogRemoteCheckQueueInformation();
+
+private:
+       static boost::mutex m_Mutex;
+       static std::deque<std::function<void ()>> m_CheckRequestQueue;
+       static bool m_CheckSchedulerRunning;
+       static int m_ChecksExecutedDuringInterval;
+       static int m_ChecksDroppedDuringInterval;
+       static Timer::Ptr m_LogTimer;
+
+       static void RemoteCheckThreadProc();
+       static void EnqueueCheck(const MessageOrigin::Ptr& origin, const Dictionary::Ptr& params);
+       static void ExecuteCheckFromQueue(const MessageOrigin::Ptr& origin, const Dictionary::Ptr& params);
 };
 
 }