1 /* Icinga 2 | (c) 2012 Icinga GmbH | GPLv2+ */
3 #ifndef SCHEDULEDDOWNTIME_H
4 #define SCHEDULEDDOWNTIME_H
6 #include "icinga/i2-icinga.hpp"
7 #include "icinga/scheduleddowntime-ti.hpp"
8 #include "icinga/checkable.hpp"
20 * An Icinga scheduled downtime specification.
24 class ScheduledDowntime final : public ObjectImpl<ScheduledDowntime>
27 DECLARE_OBJECT(ScheduledDowntime);
28 DECLARE_OBJECTNAME(ScheduledDowntime);
30 Checkable::Ptr GetCheckable() const;
32 static void EvaluateApplyRules(const intrusive_ptr<Host>& host);
33 static void EvaluateApplyRules(const intrusive_ptr<Service>& service);
34 static bool AllConfigIsLoaded();
36 void ValidateRanges(const Lazy<Dictionary::Ptr>& lvalue, const ValidationUtils& utils) override;
37 void ValidateChildOptions(const Lazy<Value>& lvalue, const ValidationUtils& utils) override;
40 void OnAllConfigLoaded() override;
41 void Start(bool runtimeCreated) override;
44 static void TimerProc();
46 std::pair<double, double> FindRunningSegment(double minEnd = 0);
47 std::pair<double, double> FindNextSegment();
48 void CreateNextDowntime();
50 static std::atomic<bool> m_AllConfigLoaded;
52 static bool EvaluateApplyRuleInstance(const Checkable::Ptr& checkable, const String& name, ScriptFrame& frame, const ApplyRule& rule);
53 static bool EvaluateApplyRule(const Checkable::Ptr& checkable, const ApplyRule& rule);
58 #endif /* SCHEDULEDDOWNTIME_H */