"Fossies" - the Fresh Open Source Software Archive

Member "icinga2-2.10.5/lib/icinga/clusterevents.hpp" (23 May 2019, 5452 Bytes) of package /linux/misc/icinga2-2.10.5.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "clusterevents.hpp" see the Fossies "Dox" file reference documentation and the last Fossies "Diffs" side-by-side code changes report: 2.10.0_vs_2.10.1.

    1 /******************************************************************************
    2  * Icinga 2                                                                   *
    3  * Copyright (C) 2012-2018 Icinga Development Team (https://icinga.com/)      *
    4  *                                                                            *
    5  * This program is free software; you can redistribute it and/or              *
    6  * modify it under the terms of the GNU General Public License                *
    7  * as published by the Free Software Foundation; either version 2             *
    8  * of the License, or (at your option) any later version.                     *
    9  *                                                                            *
   10  * This program is distributed in the hope that it will be useful,            *
   11  * but WITHOUT ANY WARRANTY; without even the implied warranty of             *
   12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              *
   13  * GNU General Public License for more details.                               *
   14  *                                                                            *
   15  * You should have received a copy of the GNU General Public License          *
   16  * along with this program; if not, write to the Free Software Foundation     *
   17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.             *
   18  ******************************************************************************/
   19 
   20 #ifndef CLUSTEREVENTS_H
   21 #define CLUSTEREVENTS_H
   22 
   23 #include "icinga/checkable.hpp"
   24 #include "icinga/host.hpp"
   25 #include "icinga/checkcommand.hpp"
   26 #include "icinga/eventcommand.hpp"
   27 #include "icinga/notificationcommand.hpp"
   28 
   29 namespace icinga
   30 {
   31 
   32 /**
   33  * @ingroup icinga
   34  */
   35 class ClusterEvents
   36 {
   37 public:
   38     static void StaticInitialize();
   39 
   40     static void CheckResultHandler(const Checkable::Ptr& checkable, const CheckResult::Ptr& cr, const MessageOrigin::Ptr& origin);
   41     static Value CheckResultAPIHandler(const MessageOrigin::Ptr& origin, const Dictionary::Ptr& params);
   42 
   43     static void NextCheckChangedHandler(const Checkable::Ptr& checkable, const MessageOrigin::Ptr& origin);
   44     static Value NextCheckChangedAPIHandler(const MessageOrigin::Ptr& origin, const Dictionary::Ptr& params);
   45 
   46     static void NextNotificationChangedHandler(const Notification::Ptr& notification, const MessageOrigin::Ptr& origin);
   47     static Value NextNotificationChangedAPIHandler(const MessageOrigin::Ptr& origin, const Dictionary::Ptr& params);
   48 
   49     static void ForceNextCheckChangedHandler(const Checkable::Ptr& checkable, const MessageOrigin::Ptr& origin);
   50     static Value ForceNextCheckChangedAPIHandler(const MessageOrigin::Ptr& origin, const Dictionary::Ptr& params);
   51 
   52     static void ForceNextNotificationChangedHandler(const Checkable::Ptr& checkable, const MessageOrigin::Ptr& origin);
   53     static Value ForceNextNotificationChangedAPIHandler(const MessageOrigin::Ptr& origin, const Dictionary::Ptr& params);
   54 
   55     static void AcknowledgementSetHandler(const Checkable::Ptr& checkable, const String& author, const String& comment, AcknowledgementType type,
   56         bool notify, bool persistent, double expiry, const MessageOrigin::Ptr& origin);
   57     static Value AcknowledgementSetAPIHandler(const MessageOrigin::Ptr& origin, const Dictionary::Ptr& params);
   58 
   59     static void AcknowledgementClearedHandler(const Checkable::Ptr& checkable, const MessageOrigin::Ptr& origin);
   60     static Value AcknowledgementClearedAPIHandler(const MessageOrigin::Ptr& origin, const Dictionary::Ptr& params);
   61 
   62     static Value ExecuteCommandAPIHandler(const MessageOrigin::Ptr& origin, const Dictionary::Ptr& params);
   63 
   64     static Dictionary::Ptr MakeCheckResultMessage(const Checkable::Ptr& checkable, const CheckResult::Ptr& cr);
   65 
   66     static void SendNotificationsHandler(const Checkable::Ptr& checkable, NotificationType type,
   67         const CheckResult::Ptr& cr, const String& author, const String& text, const MessageOrigin::Ptr& origin);
   68     static Value SendNotificationsAPIHandler(const MessageOrigin::Ptr& origin, const Dictionary::Ptr& params);
   69 
   70     static void NotificationSentUserHandler(const Notification::Ptr& notification, const Checkable::Ptr& checkable, const User::Ptr& user,
   71         NotificationType notificationType, const CheckResult::Ptr& cr, const String& author, const String& commentText, const String& command, const MessageOrigin::Ptr& origin);
   72     static Value NotificationSentUserAPIHandler(const MessageOrigin::Ptr& origin, const Dictionary::Ptr& params);
   73 
   74     static void NotificationSentToAllUsersHandler(const Notification::Ptr& notification, const Checkable::Ptr& checkable, const std::set<User::Ptr>& users,
   75         NotificationType notificationType, const CheckResult::Ptr& cr, const String& author, const String& commentText, const MessageOrigin::Ptr& origin);
   76     static Value NotificationSentToAllUsersAPIHandler(const MessageOrigin::Ptr& origin, const Dictionary::Ptr& params);
   77 
   78     static int GetCheckRequestQueueSize();
   79     static void LogRemoteCheckQueueInformation();
   80 
   81 private:
   82     static boost::mutex m_Mutex;
   83     static std::deque<std::function<void ()>> m_CheckRequestQueue;
   84     static bool m_CheckSchedulerRunning;
   85     static int m_ChecksExecutedDuringInterval;
   86     static int m_ChecksDroppedDuringInterval;
   87     static Timer::Ptr m_LogTimer;
   88 
   89     static void RemoteCheckThreadProc();
   90     static void EnqueueCheck(const MessageOrigin::Ptr& origin, const Dictionary::Ptr& params);
   91     static void ExecuteCheckFromQueue(const MessageOrigin::Ptr& origin, const Dictionary::Ptr& params);
   92 };
   93 
   94 }
   95 
   96 #endif /* CLUSTEREVENTS_H */