Example:
object Service "localhost-uptime" {
- host = "localhost"
- short_name = "uptime"
+ host_name = "localhost"
+ name = "uptime"
display_name = "localhost Uptime"
Name |Description
----------------|----------------
- host |**Required.** The host this service belongs to. There must be a `Host` object with that name.
- short_name |**Required.** The service name. Must be unique on a per-host basis (Similar to the service_description attribute in Icinga 1.x).
+ host_name |**Required.** The host this service belongs to. There must be a `Host` object with that name.
+ name |**Required.** The service name. Must be unique on a per-host basis (Similar to the service_description attribute in Icinga 1.x).
display_name |**Optional.** A short description of the service.
vars |**Optional.** A dictionary containing custom attributes that are specific to this host.
check\_command |**Required.** The name of the check command.
Example:
object Notification "localhost-ping-notification" {
- host = "localhost"
- service = "ping4"
+ host_name = "localhost"
+ service_name = "ping4"
notification_command = "mail-notification"
Name |Description
----------------|----------------
- host |**Required.** The name of the host this notification belongs to.
- service |**Required.** The short name of the service this notification belongs to.
+ host_name |**Required.** The name of the host this notification belongs to.
+ service_name |**Required.** The short name of the service this notification belongs to.
vars |**Optional.** A dictionary containing custom attributes that are specific to this notification object.
users |**Optional.** A list of user names who should be notified.
user_groups |**Optional.** A list of user group names who should be notified.
Example:
object Dependency "webserver-internet" {
- child_host = "webserver"
- child_service = "ping4"
+ child_host_name = "webserver"
+ child_service_name = "ping4"
- parent_host = "internet"
- parent_service = "ping4"
+ parent_host_name = "internet"
+ parent_service_name = "ping4"
state_filter = StateFilterOK
Example:
object ScheduledDowntime "some-downtime" {
- host = "localhost"
- service = "ping4"
+ host_name = "localhost"
+ service_name = "ping4"
author = "icingaadmin"
comment = "Some comment"
Name |Description
----------------|----------------
- host |**Required.** The name of the host this notification belongs to.
- service |**Required.** The short name of the service this notification belongs to.
+ host_name |**Required.** The name of the host this notification belongs to.
+ service_name |**Required.** The short name of the service this notification belongs to.
author |**Required.** The author of the downtime.
comment |**Required.** A comment for the downtime.
fixed |**Optional.** Whether this is a fixed downtime. Defaults to true.
apply ScheduledDowntime "backup-downtime" {
import "backup-downtime"
- assign where service.host == "localhost" && service.short_name == "load"
+ assign where host.name == "localhost" && service.name == "load"
}
apply Service "processes" {
abstract class DynamicObject
{
- [config] String name (Name);
+ [config] String __name (Name);
+ [config] String name (ShortName) {
+ get {{{
+ if (m_ShortName.IsEmpty())
+ return GetName();
+ else
+ return m_ShortName;
+ }}}
+ };
[config, get_protected] String type (TypeName);
[config, get_protected] Array::Ptr templates;
[config] Dictionary::Ptr methods;
******************************************************************************/
%type DynamicObject {
- %require "name",
- %attribute %string "name",
+ %require "__name",
+ %attribute %string "__name",
%require "type",
%attribute %string "type",
if (!m_Properties) {
m_Properties = make_shared<Dictionary>();
m_Properties->Set("type", m_Type);
- m_Properties->Set("name", m_Name);
+ m_Properties->Set("__name", m_Name);
m_Properties->Set("__parent", m_Scope);
GetExpressionList()->Evaluate(m_Properties);
m_Properties->Remove("__parent");
- VERIFY(m_Properties->Get("type") == GetType() && m_Properties->Get("name") == GetName());
+ VERIFY(m_Properties->Get("type") == GetType() && m_Properties->Get("__name") == GetName());
}
return m_Properties;
builder->SetScope(rule.GetScope());
builder->AddExpression(make_shared<AExpression>(&AExpression::OpSet,
- make_shared<AExpression>(&AExpression::OpLiteral, "child_host", di),
+ make_shared<AExpression>(&AExpression::OpLiteral, "child_host_name", di),
make_shared<AExpression>(&AExpression::OpLiteral, service->GetHost()->GetName(),
di), di));
builder->AddExpression(make_shared<AExpression>(&AExpression::OpSet,
- make_shared<AExpression>(&AExpression::OpLiteral, "child_service", di),
+ make_shared<AExpression>(&AExpression::OpLiteral, "child_service_name", di),
make_shared<AExpression>(&AExpression::OpLiteral, service->GetShortName(), di), di));
builder->AddExpression(rule.GetExpression());
Checkable::Ptr Dependency::GetChild(void) const
{
- Host::Ptr host = Host::GetByName(GetChildHostRaw());
+ Host::Ptr host = Host::GetByName(GetChildHostName());
if (!host)
return Service::Ptr();
- if (GetChildServiceRaw().IsEmpty())
+ if (GetChildServiceName().IsEmpty())
return host;
else
- return host->GetServiceByShortName(GetChildServiceRaw());
+ return host->GetServiceByShortName(GetChildServiceName());
}
Checkable::Ptr Dependency::GetParent(void) const
{
- Host::Ptr host = Host::GetByName(GetParentHostRaw());
+ Host::Ptr host = Host::GetByName(GetParentHostName());
if (!host)
return Service::Ptr();
- if (GetParentServiceRaw().IsEmpty())
+ if (GetParentServiceName().IsEmpty())
return host;
else
- return host->GetServiceByShortName(GetParentServiceRaw());
+ return host->GetServiceByShortName(GetParentServiceName());
}
TimePeriod::Ptr Dependency::GetPeriod(void) const
class Dependency : DynamicObject
{
- [config] String child_host (ChildHostRaw);
- [config] String child_service (ChildServiceRaw);
+ [config] String child_host_name;
+ [config] String child_service_name;
- [config] String parent_host (ParentHostRaw);
- [config] String parent_service (ParentServiceRaw);
+ [config] String parent_host_name;
+ [config] String parent_service_name;
[config] String period (PeriodRaw);
}
%type Service %inherits Checkable {
- %require "host",
- %attribute %name(Host) "host",
-
- %attribute %string "short_name",
+ %require "host_name",
+ %attribute %name(Host) "host_name",
+ %attribute %string "name",
%attribute %array "groups" {
%attribute %name(ServiceGroup) "*"
}
%type Notification {
- %require "host",
- %attribute %name(Host) "host",
+ %require "host_name",
+ %attribute %name(Host) "host_name",
- %require "service",
- %attribute %string "service",
+ %require "service_name",
+ %attribute %string "service_name",
%attribute %array "users" {
%attribute %name(User) "*"
}
%type ScheduledDowntime {
- %require "host",
- %attribute %name(Host) "host",
- %require "service",
- %attribute %string "service",
+ %require "host_name",
+ %attribute %name(Host) "host_name",
+ %require "service_name",
+ %attribute %string "service_name",
%require "author",
%attribute %string "author",
}
%type Dependency {
- %require "parent_host",
- %attribute %name(Host) "parent_host",
- %attribute %string "parent_service",
+ %require "parent_host_name",
+ %attribute %name(Host) "parent_host_name",
+ %attribute %string "parent_service_name",
- %require "child_host",
- %attribute %name(Host) "child_host",
- %attribute %string "child_service",
+ %require "child_host_name",
+ %attribute %name(Host) "child_host_name",
+ %attribute %string "child_service_name",
%attribute %name(TimePeriod) "period",
builder->SetScope(rule.GetScope());
builder->AddExpression(make_shared<AExpression>(&AExpression::OpSet,
- make_shared<AExpression>(&AExpression::OpLiteral, "host", di),
+ make_shared<AExpression>(&AExpression::OpLiteral, "host_name", di),
make_shared<AExpression>(&AExpression::OpLiteral, service->GetHost()->GetName(), di),
di));
builder->AddExpression(make_shared<AExpression>(&AExpression::OpSet,
- make_shared<AExpression>(&AExpression::OpLiteral, "service", di),
+ make_shared<AExpression>(&AExpression::OpLiteral, "service_name", di),
make_shared<AExpression>(&AExpression::OpLiteral, service->GetShortName(), di),
di));
Checkable::Ptr Notification::GetCheckable(void) const
{
- Host::Ptr host = Host::GetByName(GetHostRaw());
+ Host::Ptr host = Host::GetByName(GetHostName());
- if (GetServiceRaw().IsEmpty())
+ if (GetServiceName().IsEmpty())
return host;
else
- return host->GetServiceByShortName(GetServiceRaw());
+ return host->GetServiceByShortName(GetServiceName());
}
NotificationCommand::Ptr Notification::GetNotificationCommand(void) const
[config] int notification_state_filter {
default {{{ return ~(int)0; }}}
};
- [config, protected] String host (HostRaw);
- [config, protected] String service (ServiceRaw);
+ [config, protected] String host_name;
+ [config, protected] String service_name;
[state] double last_notification;
[state, set_protected] double next_notification (NextNotificationRaw);
builder->SetScope(rule.GetScope());
builder->AddExpression(make_shared<AExpression>(&AExpression::OpSet,
- make_shared<AExpression>(&AExpression::OpLiteral, "host", di),
+ make_shared<AExpression>(&AExpression::OpLiteral, "host_name", di),
make_shared<AExpression>(&AExpression::OpLiteral, service->GetHost()->GetName(), di),
di));
builder->AddExpression(make_shared<AExpression>(&AExpression::OpSet,
- make_shared<AExpression>(&AExpression::OpLiteral, "service", di),
+ make_shared<AExpression>(&AExpression::OpLiteral, "service_name", di),
make_shared<AExpression>(&AExpression::OpLiteral, service->GetShortName(), di),
di));
Checkable::Ptr ScheduledDowntime::GetCheckable(void) const
{
- Host::Ptr host = Host::GetByName(GetHostRaw());
+ Host::Ptr host = Host::GetByName(GetHostName());
- if (GetServiceRaw().IsEmpty())
+ if (GetServiceName().IsEmpty())
return host;
else
- return host->GetServiceByShortName(GetServiceRaw());
+ return host->GetServiceByShortName(GetServiceName());
}
std::pair<double, double> ScheduledDowntime::FindNextSegment(void)
class ScheduledDowntime : DynamicObject
{
- [config, protected] String host (HostRaw);
- [config, protected] String service (ServiceRaw);
+ [config, protected] String host_name;
+ [config, protected] String service_name;
[config] String author;
[config] String comment;
builder->SetScope(rule.GetScope());
builder->AddExpression(make_shared<AExpression>(&AExpression::OpSet,
- make_shared<AExpression>(&AExpression::OpLiteral, "host", di),
+ make_shared<AExpression>(&AExpression::OpLiteral, "host_name", di),
make_shared<AExpression>(&AExpression::OpLiteral, host->GetName(), di),
di));
builder->AddExpression(make_shared<AExpression>(&AExpression::OpSet,
- make_shared<AExpression>(&AExpression::OpLiteral, "short_name", di),
+ make_shared<AExpression>(&AExpression::OpLiteral, "name", di),
make_shared<AExpression>(&AExpression::OpLiteral, rule.GetName(), di),
di));
}
}
- m_Host = Host::GetByName(GetHostRaw());
+ m_Host = Host::GetByName(GetHostName());
if (m_Host)
m_Host->AddService(GetSelf());
return m_DisplayName;
}}}
};
- [config] String short_name {
- get {{{
- if (m_ShortName.IsEmpty())
- return GetName();
- else
- return m_ShortName;
- }}}
- };
- [config] String host (HostRaw);
+ [config] String host_name;
[enum] ServiceState "state" {
get {{{
return GetStateRaw();