mirror of https://github.com/Icinga/icinga2.git
Add downtime handlers to state sync
This commit is contained in:
parent
af05a354fa
commit
2202bde56c
|
@ -57,6 +57,13 @@ void RedisWriter::ConfigStaticInitialize()
|
|||
/* triggered on create, update and delete objects */
|
||||
ConfigObject::OnActiveChanged.connect(std::bind(&RedisWriter::VersionChangedHandler, _1));
|
||||
ConfigObject::OnVersionChanged.connect(std::bind(&RedisWriter::VersionChangedHandler, _1));
|
||||
|
||||
/* fixed downtime start */
|
||||
Downtime::OnDowntimeStarted.connect(std::bind(&RedisWriter::DowntimeChangedHandler, _1));
|
||||
/* flexible downtime start */
|
||||
Downtime::OnDowntimeTriggered.connect(std::bind(&RedisWriter::DowntimeChangedHandler, _1));
|
||||
/* fixed/flexible downtime end */
|
||||
Downtime::OnDowntimeRemoved.connect(std::bind(&RedisWriter::DowntimeChangedHandler, _1));
|
||||
}
|
||||
|
||||
void RedisWriter::UpdateAllConfigObjects()
|
||||
|
@ -771,3 +778,9 @@ void RedisWriter::VersionChangedHandler(const ConfigObject::Ptr& object)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
void RedisWriter::DowntimeChangedHandler(const Downtime::Ptr& downtime)
|
||||
{
|
||||
Log(LogCritical, "Downtime", "Downtime sync got triggered");
|
||||
StateChangeHandler(downtime->GetCheckable());
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include "base/workqueue.hpp"
|
||||
#include "redis/redisconnection.hpp"
|
||||
#include "icinga/checkable.hpp"
|
||||
#include "icinga/downtime.hpp"
|
||||
#include <hiredis/hiredis.h>
|
||||
|
||||
namespace icinga
|
||||
|
@ -101,6 +102,7 @@ private:
|
|||
|
||||
static void StateChangeHandler(const ConfigObject::Ptr &object);
|
||||
static void VersionChangedHandler(const ConfigObject::Ptr& object);
|
||||
static void DowntimeChangedHandler(const Downtime::Ptr& downtime);
|
||||
|
||||
void AssertOnWorkQueue();
|
||||
|
||||
|
|
Loading…
Reference in New Issue