return Empty;
}
+ double nextCheck = params->Get("next_check");
+
+ if (nextCheck < Application::GetStartTime() + 60)
+ return Empty;
+
checkable->SetNextCheck(params->Get("next_check"), false, origin);
return Empty;
return Empty;
}
- notification->SetNextNotification(params->Get("next_notification"), false, origin);
+ double nextNotification = params->Get("next_notification");
+
+ if (nextNotification < Utility::GetTime())
+ return Empty;
+
+ notification->SetNextNotification(nextNotification, false, origin);
return Empty;
}
#include "icinga/notification.tcpp"
#include "icinga/notificationcommand.hpp"
#include "icinga/service.hpp"
+#include "remote/apilistener.hpp"
#include "base/objectlock.hpp"
#include "base/logger.hpp"
#include "base/utility.hpp"
void Notification::Start(bool runtimeCreated)
{
- ObjectImpl<Notification>::Start(runtimeCreated);
-
Checkable::Ptr obj = GetCheckable();
if (obj)
obj->RegisterNotification(this);
+
+ if (ApiListener::IsHACluster() && GetNextNotification() < Utility::GetTime() + 60)
+ SetNextNotification(Utility::GetTime() + 60, true);
+
+ ObjectImpl<Notification>::Start(runtimeCreated);
}
void Notification::Stop(bool runtimeRemoved)
"Must be one of '" SSL_TXT_TLSV1 "', '" SSL_TXT_TLSV1_1 "' or '" SSL_TXT_TLSV1_2 "'"));
}
}
+
+bool ApiListener::IsHACluster(void)
+{
+ Zone::Ptr zone = Zone::GetLocalZone();
+
+ if (!zone)
+ return false;
+
+ return zone->IsSingleInstance();
+}
+
static void UpdateObjectAuthority(void);
+ static bool IsHACluster(void);
+
protected:
virtual void OnConfigLoaded(void) override;
virtual void OnAllConfigLoaded(void) override;
return GetGlobal();
}
+bool Zone::IsSingleInstance(void) const
+{
+ Array::Ptr endpoints = GetEndpointsRaw();
+ return !endpoints || endpoints->GetLength() < 2;
+}
+
Zone::Ptr Zone::GetLocalZone(void)
{
Endpoint::Ptr local = Endpoint::GetLocalEndpoint();
bool CanAccessObject(const ConfigObject::Ptr& object);
bool IsChildOf(const Zone::Ptr& zone);
bool IsGlobal(void) const;
+ bool IsSingleInstance(void) const;
static Zone::Ptr GetLocalZone(void);