2019-02-25 14:48:22 +01:00
|
|
|
/* Icinga 2 | (c) 2012 Icinga GmbH | GPLv2+ */
|
2015-10-19 17:31:18 +02:00
|
|
|
|
|
|
|
#ifndef CLUSTEREVENTS_H
|
|
|
|
#define CLUSTEREVENTS_H
|
|
|
|
|
|
|
|
#include "icinga/checkable.hpp"
|
|
|
|
#include "icinga/host.hpp"
|
|
|
|
#include "icinga/checkcommand.hpp"
|
|
|
|
#include "icinga/eventcommand.hpp"
|
|
|
|
#include "icinga/notificationcommand.hpp"
|
|
|
|
|
|
|
|
namespace icinga
|
|
|
|
{
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @ingroup icinga
|
|
|
|
*/
|
2017-12-31 07:22:16 +01:00
|
|
|
class ClusterEvents
|
2015-10-19 17:31:18 +02:00
|
|
|
{
|
|
|
|
public:
|
2018-01-04 04:25:35 +01:00
|
|
|
static void StaticInitialize();
|
2015-10-19 17:31:18 +02:00
|
|
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
static void NextCheckChangedHandler(const Checkable::Ptr& checkable, const MessageOrigin::Ptr& origin);
|
|
|
|
static Value NextCheckChangedAPIHandler(const MessageOrigin::Ptr& origin, const Dictionary::Ptr& params);
|
|
|
|
|
2019-07-02 11:23:16 +02:00
|
|
|
static void SuppressedNotificationsChangedHandler(const Checkable::Ptr& checkable, const MessageOrigin::Ptr& origin);
|
|
|
|
static Value SuppressedNotificationsChangedAPIHandler(const MessageOrigin::Ptr& origin, const Dictionary::Ptr& params);
|
|
|
|
|
2015-10-19 17:31:18 +02:00
|
|
|
static void NextNotificationChangedHandler(const Notification::Ptr& notification, const MessageOrigin::Ptr& origin);
|
|
|
|
static Value NextNotificationChangedAPIHandler(const MessageOrigin::Ptr& origin, const Dictionary::Ptr& params);
|
|
|
|
|
|
|
|
static void ForceNextCheckChangedHandler(const Checkable::Ptr& checkable, const MessageOrigin::Ptr& origin);
|
|
|
|
static Value ForceNextCheckChangedAPIHandler(const MessageOrigin::Ptr& origin, const Dictionary::Ptr& params);
|
|
|
|
|
|
|
|
static void ForceNextNotificationChangedHandler(const Checkable::Ptr& checkable, const MessageOrigin::Ptr& origin);
|
|
|
|
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,
|
2017-12-19 15:50:05 +01:00
|
|
|
bool notify, bool persistent, double expiry, const MessageOrigin::Ptr& origin);
|
2015-10-19 17:31:18 +02:00
|
|
|
static Value AcknowledgementSetAPIHandler(const MessageOrigin::Ptr& origin, const Dictionary::Ptr& params);
|
|
|
|
|
2019-11-28 17:46:12 +01:00
|
|
|
static void AcknowledgementClearedHandler(const Checkable::Ptr& checkable, const String& removedBy, const MessageOrigin::Ptr& origin);
|
2015-10-19 17:31:18 +02:00
|
|
|
static Value AcknowledgementClearedAPIHandler(const MessageOrigin::Ptr& origin, const Dictionary::Ptr& params);
|
|
|
|
|
|
|
|
static Value ExecuteCommandAPIHandler(const MessageOrigin::Ptr& origin, const Dictionary::Ptr& params);
|
|
|
|
|
|
|
|
static Dictionary::Ptr MakeCheckResultMessage(const Checkable::Ptr& checkable, const CheckResult::Ptr& cr);
|
2016-06-07 12:44:12 +02:00
|
|
|
|
|
|
|
static void SendNotificationsHandler(const Checkable::Ptr& checkable, NotificationType type,
|
2017-12-19 15:50:05 +01:00
|
|
|
const CheckResult::Ptr& cr, const String& author, const String& text, const MessageOrigin::Ptr& origin);
|
2016-06-07 12:44:12 +02:00
|
|
|
static Value SendNotificationsAPIHandler(const MessageOrigin::Ptr& origin, const Dictionary::Ptr& params);
|
2016-06-15 11:27:01 +02:00
|
|
|
|
|
|
|
static void NotificationSentUserHandler(const Notification::Ptr& notification, const Checkable::Ptr& checkable, const User::Ptr& user,
|
2019-03-28 11:42:28 +01:00
|
|
|
NotificationType notificationType, const CheckResult::Ptr& cr, const NotificationResult::Ptr& nr,
|
|
|
|
const String& author, const String& commentText, const String& command, const MessageOrigin::Ptr& origin);
|
2016-06-15 11:27:01 +02:00
|
|
|
static Value NotificationSentUserAPIHandler(const MessageOrigin::Ptr& origin, const Dictionary::Ptr& params);
|
|
|
|
|
2016-08-15 17:26:01 +02:00
|
|
|
static void NotificationSentToAllUsersHandler(const Notification::Ptr& notification, const Checkable::Ptr& checkable, const std::set<User::Ptr>& users,
|
2017-12-19 15:50:05 +01:00
|
|
|
NotificationType notificationType, const CheckResult::Ptr& cr, const String& author, const String& commentText, const MessageOrigin::Ptr& origin);
|
2016-08-16 09:30:10 +02:00
|
|
|
static Value NotificationSentToAllUsersAPIHandler(const MessageOrigin::Ptr& origin, const Dictionary::Ptr& params);
|
2018-01-16 10:40:08 +01:00
|
|
|
|
2018-01-18 15:22:16 +01:00
|
|
|
static int GetCheckRequestQueueSize();
|
|
|
|
static void LogRemoteCheckQueueInformation();
|
|
|
|
|
2018-01-16 10:40:08 +01:00
|
|
|
private:
|
|
|
|
static boost::mutex m_Mutex;
|
|
|
|
static std::deque<std::function<void ()>> m_CheckRequestQueue;
|
|
|
|
static bool m_CheckSchedulerRunning;
|
2018-01-18 15:22:16 +01:00
|
|
|
static int m_ChecksExecutedDuringInterval;
|
|
|
|
static int m_ChecksDroppedDuringInterval;
|
|
|
|
static Timer::Ptr m_LogTimer;
|
2018-01-16 10:40:08 +01:00
|
|
|
|
|
|
|
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);
|
2015-10-19 17:31:18 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* CLUSTEREVENTS_H */
|