mirror of https://github.com/Icinga/icinga2.git
parent
48569b6205
commit
cac4167e79
|
@ -31,15 +31,18 @@ using namespace icinga;
|
|||
|
||||
REGISTER_TYPE(CheckerComponent);
|
||||
|
||||
void CheckerComponent::Start(void)
|
||||
void CheckerComponent::OnConfigLoaded(void)
|
||||
{
|
||||
DynamicObject::Start();
|
||||
|
||||
DynamicObject::OnStarted.connect(bind(&CheckerComponent::ObjectHandler, this, _1));
|
||||
DynamicObject::OnStopped.connect(bind(&CheckerComponent::ObjectHandler, this, _1));
|
||||
DynamicObject::OnAuthorityChanged.connect(bind(&CheckerComponent::ObjectHandler, this, _1));
|
||||
|
||||
Service::OnNextCheckChanged.connect(bind(&CheckerComponent::NextCheckChangedHandler, this, _1));
|
||||
}
|
||||
|
||||
void CheckerComponent::Start(void)
|
||||
{
|
||||
DynamicObject::Start();
|
||||
|
||||
m_Stopped = false;
|
||||
|
||||
|
@ -49,10 +52,6 @@ void CheckerComponent::Start(void)
|
|||
m_ResultTimer->SetInterval(5);
|
||||
m_ResultTimer->OnTimerExpired.connect(boost::bind(&CheckerComponent::ResultTimerHandler, this));
|
||||
m_ResultTimer->Start();
|
||||
|
||||
BOOST_FOREACH(const Service::Ptr& service, DynamicType::GetObjects<Service>()) {
|
||||
ObjectHandler(service);
|
||||
}
|
||||
}
|
||||
|
||||
void CheckerComponent::Stop(void)
|
||||
|
|
|
@ -67,6 +67,7 @@ public:
|
|||
>
|
||||
> ServiceSet;
|
||||
|
||||
virtual void OnConfigLoaded(void);
|
||||
virtual void Start(void);
|
||||
virtual void Stop(void);
|
||||
|
||||
|
|
|
@ -45,11 +45,6 @@ boost::signals2::signal<void (const DynamicObject::Ptr&)> DynamicObject::OnState
|
|||
boost::signals2::signal<void (const DynamicObject::Ptr&, const String&, bool)> DynamicObject::OnAuthorityChanged;
|
||||
|
||||
DynamicObject::DynamicObject(void)
|
||||
{
|
||||
SetActive(false);
|
||||
}
|
||||
|
||||
DynamicObject::~DynamicObject(void)
|
||||
{ }
|
||||
|
||||
DynamicType::Ptr DynamicObject::GetType(void) const
|
||||
|
|
|
@ -52,8 +52,6 @@ class I2_BASE_API DynamicObject : public ObjectImpl<DynamicObject>
|
|||
public:
|
||||
DECLARE_PTR_TYPEDEFS(DynamicObject);
|
||||
|
||||
~DynamicObject(void);
|
||||
|
||||
static boost::signals2::signal<void (const DynamicObject::Ptr&)> OnStarted;
|
||||
static boost::signals2::signal<void (const DynamicObject::Ptr&)> OnStopped;
|
||||
static boost::signals2::signal<void (const DynamicObject::Ptr&)> OnStateChanged;
|
||||
|
|
|
@ -44,14 +44,19 @@ Service::Service(void)
|
|||
|
||||
void Service::Start(void)
|
||||
{
|
||||
DynamicObject::Start();
|
||||
|
||||
VERIFY(GetHost());
|
||||
|
||||
AddDowntimesToCache();
|
||||
AddCommentsToCache();
|
||||
|
||||
StartDowntimesExpiredTimer();
|
||||
|
||||
double now = Utility::GetTime();
|
||||
|
||||
if (GetNextCheck() < now + 300)
|
||||
SetNextCheck(now + Utility::Random() % 300);
|
||||
|
||||
DynamicObject::Start();
|
||||
}
|
||||
|
||||
void Service::OnConfigLoaded(void)
|
||||
|
@ -77,9 +82,6 @@ void Service::OnConfigLoaded(void)
|
|||
UpdateSlaveNotifications();
|
||||
|
||||
SetSchedulingOffset(Utility::Random());
|
||||
|
||||
if (GetNextCheck() < Utility::GetTime() + 300)
|
||||
SetNextCheck(Utility::GetTime() + Utility::Random() % 300);
|
||||
}
|
||||
|
||||
Service::Ptr Service::GetByNamePair(const String& hostName, const String& serviceName)
|
||||
|
|
Loading…
Reference in New Issue