mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-20 12:14:44 +02:00
parent
005e0f532f
commit
39ded04e1a
@ -51,6 +51,27 @@ Checkable::Checkable(void)
|
|||||||
SetSchedulingOffset(Utility::Random());
|
SetSchedulingOffset(Utility::Random());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Checkable::OnAllConfigLoaded(void)
|
||||||
|
{
|
||||||
|
ObjectImpl<Checkable>::OnAllConfigLoaded();
|
||||||
|
|
||||||
|
Endpoint::Ptr endpoint = GetCommandEndpoint();
|
||||||
|
|
||||||
|
if (endpoint) {
|
||||||
|
Zone::Ptr checkableZone = static_pointer_cast<Zone>(GetZone());
|
||||||
|
|
||||||
|
if (!checkableZone)
|
||||||
|
checkableZone = Zone::GetLocalZone();
|
||||||
|
|
||||||
|
Zone::Ptr cmdZone = endpoint->GetZone();
|
||||||
|
|
||||||
|
if (cmdZone != checkableZone && cmdZone->GetParent() != checkableZone) {
|
||||||
|
BOOST_THROW_EXCEPTION(ValidationError(this, boost::assign::list_of("command_endpoint"),
|
||||||
|
"Command endpoint must be in zone '" + checkableZone->GetName() + "' or in a direct child zone thereof."));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Checkable::Start(bool runtimeCreated)
|
void Checkable::Start(bool runtimeCreated)
|
||||||
{
|
{
|
||||||
double now = Utility::GetTime();
|
double now = Utility::GetTime();
|
||||||
|
@ -185,6 +185,7 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void Start(bool runtimeCreated) override;
|
virtual void Start(bool runtimeCreated) override;
|
||||||
|
virtual void OnAllConfigLoaded(void) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
mutable boost::mutex m_CheckableMutex;
|
mutable boost::mutex m_CheckableMutex;
|
||||||
|
@ -44,6 +44,10 @@ enum AcknowledgementType
|
|||||||
|
|
||||||
abstract class Checkable : CustomVarObject
|
abstract class Checkable : CustomVarObject
|
||||||
{
|
{
|
||||||
|
load_after ApiListener;
|
||||||
|
load_after Endpoint;
|
||||||
|
load_after Zone;
|
||||||
|
|
||||||
[config, required, navigation] name(CheckCommand) check_command (CheckCommandRaw) {
|
[config, required, navigation] name(CheckCommand) check_command (CheckCommandRaw) {
|
||||||
navigate {{{
|
navigate {{{
|
||||||
return CheckCommand::GetByName(GetCheckCommandRaw());
|
return CheckCommand::GetByName(GetCheckCommandRaw());
|
||||||
|
@ -37,7 +37,7 @@ boost::signals2::signal<void(const Endpoint::Ptr&, const JsonRpcConnection::Ptr&
|
|||||||
|
|
||||||
void Endpoint::OnAllConfigLoaded(void)
|
void Endpoint::OnAllConfigLoaded(void)
|
||||||
{
|
{
|
||||||
ConfigObject::OnConfigLoaded();
|
ObjectImpl<Endpoint>::OnAllConfigLoaded();
|
||||||
|
|
||||||
BOOST_FOREACH(const Zone::Ptr& zone, ConfigType::GetObjectsByType<Zone>()) {
|
BOOST_FOREACH(const Zone::Ptr& zone, ConfigType::GetObjectsByType<Zone>()) {
|
||||||
const std::set<Endpoint::Ptr> members = zone->GetEndpoints();
|
const std::set<Endpoint::Ptr> members = zone->GetEndpoints();
|
||||||
|
@ -30,6 +30,8 @@ REGISTER_TYPE(Zone);
|
|||||||
|
|
||||||
void Zone::OnAllConfigLoaded(void)
|
void Zone::OnAllConfigLoaded(void)
|
||||||
{
|
{
|
||||||
|
ObjectImpl<Zone>::OnAllConfigLoaded();
|
||||||
|
|
||||||
m_Parent = Zone::GetByName(GetParentRaw());
|
m_Parent = Zone::GetByName(GetParentRaw());
|
||||||
|
|
||||||
Zone::Ptr zone = m_Parent;
|
Zone::Ptr zone = m_Parent;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user