mirror of https://github.com/Icinga/icinga2.git
parent
93da4baf8f
commit
75b599c801
|
@ -21,3 +21,9 @@ template Service "agent-service" {
|
|||
|
||||
}
|
||||
|
||||
|
||||
apply Dependency "agent-host" to Host {
|
||||
parent_host_name = host.zone
|
||||
|
||||
assign where host.zone != "" && "agent-host" in host.templates
|
||||
}
|
||||
|
|
|
@ -55,6 +55,7 @@ bool Dependency::EvaluateApplyRuleOne(const Checkable::Ptr& checkable, const App
|
|||
tie(host, service) = GetHostService(checkable);
|
||||
|
||||
Dictionary::Ptr locals = make_shared<Dictionary>();
|
||||
locals->Set("__parent", rule.GetScope());
|
||||
locals->Set("host", host);
|
||||
if (service)
|
||||
locals->Set("service", service);
|
||||
|
@ -68,7 +69,7 @@ bool Dependency::EvaluateApplyRuleOne(const Checkable::Ptr& checkable, const App
|
|||
ConfigItemBuilder::Ptr builder = make_shared<ConfigItemBuilder>(di);
|
||||
builder->SetType("Dependency");
|
||||
builder->SetName(rule.GetName());
|
||||
builder->SetScope(rule.GetScope());
|
||||
builder->SetScope(locals);
|
||||
|
||||
builder->AddExpression(make_shared<Expression>(&Expression::OpSet,
|
||||
make_shared<Expression>(&Expression::OpLiteral, "parent_host_name", di),
|
||||
|
|
|
@ -55,6 +55,7 @@ bool Notification::EvaluateApplyRuleOne(const Checkable::Ptr& checkable, const A
|
|||
tie(host, service) = GetHostService(checkable);
|
||||
|
||||
Dictionary::Ptr locals = make_shared<Dictionary>();
|
||||
locals->Set("__parent", rule.GetScope());
|
||||
locals->Set("host", host);
|
||||
if (service)
|
||||
locals->Set("service", service);
|
||||
|
@ -68,7 +69,7 @@ bool Notification::EvaluateApplyRuleOne(const Checkable::Ptr& checkable, const A
|
|||
ConfigItemBuilder::Ptr builder = make_shared<ConfigItemBuilder>(di);
|
||||
builder->SetType("Notification");
|
||||
builder->SetName(rule.GetName());
|
||||
builder->SetScope(rule.GetScope());
|
||||
builder->SetScope(locals);
|
||||
|
||||
builder->AddExpression(make_shared<Expression>(&Expression::OpSet,
|
||||
make_shared<Expression>(&Expression::OpLiteral, "host_name", di),
|
||||
|
|
|
@ -54,6 +54,7 @@ bool ScheduledDowntime::EvaluateApplyRule(const Checkable::Ptr& checkable, const
|
|||
tie(host, service) = GetHostService(checkable);
|
||||
|
||||
Dictionary::Ptr locals = make_shared<Dictionary>();
|
||||
locals->Set("__parent", rule.GetScope());
|
||||
locals->Set("host", host);
|
||||
if (service)
|
||||
locals->Set("service", service);
|
||||
|
@ -67,7 +68,7 @@ bool ScheduledDowntime::EvaluateApplyRule(const Checkable::Ptr& checkable, const
|
|||
ConfigItemBuilder::Ptr builder = make_shared<ConfigItemBuilder>(di);
|
||||
builder->SetType("ScheduledDowntime");
|
||||
builder->SetName(rule.GetName());
|
||||
builder->SetScope(rule.GetScope());
|
||||
builder->SetScope(locals);
|
||||
|
||||
builder->AddExpression(make_shared<Expression>(&Expression::OpSet,
|
||||
make_shared<Expression>(&Expression::OpLiteral, "host_name", di),
|
||||
|
|
|
@ -49,6 +49,7 @@ bool Service::EvaluateApplyRuleOne(const Host::Ptr& host, const ApplyRule& rule)
|
|||
CONTEXT(msgbuf.str());
|
||||
|
||||
Dictionary::Ptr locals = make_shared<Dictionary>();
|
||||
locals->Set("__parent", rule.GetScope());
|
||||
locals->Set("host", host);
|
||||
|
||||
if (!rule.EvaluateFilter(locals))
|
||||
|
@ -60,7 +61,7 @@ bool Service::EvaluateApplyRuleOne(const Host::Ptr& host, const ApplyRule& rule)
|
|||
ConfigItemBuilder::Ptr builder = make_shared<ConfigItemBuilder>(di);
|
||||
builder->SetType("Service");
|
||||
builder->SetName(rule.GetName());
|
||||
builder->SetScope(rule.GetScope());
|
||||
builder->SetScope(locals);
|
||||
|
||||
builder->AddExpression(make_shared<Expression>(&Expression::OpSet,
|
||||
make_shared<Expression>(&Expression::OpLiteral, "host_name", di),
|
||||
|
|
Loading…
Reference in New Issue