Update example config.

Refs #5878
This commit is contained in:
Gunnar Beutner 2014-03-28 16:32:15 +01:00
parent 0e79abb8f2
commit fa11e5a97e
6 changed files with 101 additions and 124 deletions

View File

@ -1,59 +1,44 @@
/**
* Provides default settings for hosts. By convention
* all hosts should inherit from this template.
* all hosts should import this template.
*/
template Host "generic-host" {
check = "ping4"
}
apply Service "ping4" {
import "generic-service",
check_command = "ping4",
assign where "generic-host" in host.templates
}
apply Service "ping6" {
import "generic-service",
check_command = "ping6",
assign where "generic-host" in host.templates,
ignore where !host.macros.address6
}
template Host "linux-server" {
import "generic-host",
groups += [ "linux-servers" ],
services["ping4"] = {
templates = [ "generic-service" ],
check_command = "ping4"
},
check = "ping4"
}
template Host "windows-server" {
import "generic-host",
groups += [ "windows-servers" ],
services["ping4"] = {
templates = [ "generic-service" ],
check_command = "ping4"
},
check = "ping4"
}
template Host "generic-printer" {
import "generic-host",
services["ping4"] = {
templates = [ "generic-service" ],
check_command = "ping4"
},
check = "ping4"
}
template Host "generic-switch" {
import "generic-host",
services["ping4"] = {
templates = [ "generic-service" ],
check_command = "ping4"
},
check = "ping4"
}

View File

@ -1,15 +1,18 @@
/**
* Provides default settings for services. By convention
* all services should inherit from this template.
* all services should import this template.
*/
template Service "generic-service" {
max_check_attempts = 3,
check_interval = 5m,
retry_interval = 1m,
enable_perfdata = true,
notifications["mail-icingaadmin"] = {
templates = [ "mail-notification" ],
user_groups = [ "icingaadmins" ]
}
enable_perfdata = true
}
apply Notification "mail-icingaadmin" {
import "mail-notification",
user_groups = [ "icingaadmins"],
assign where "generic-service" in service.templates
}

View File

@ -4,19 +4,5 @@
*/
template User "generic-user" {
enable_notifications = true,
notification_period = "24x7",
notification_state_filter = StateFilterWarning |
StateFilterCritical |
StateFilterUnknown,
notification_type_filter = NotificationFilterProblem |
NotificationFilterAcknowledgement |
NotificationFilterRecovery |
NotificationFilterCustom |
NotificationFilterFlappingStart |
NotificationFilterFlappingEnd |
NotificationFilterDowntimeStart |
NotificationFilterDowntimeEnd |
NotificationFilterDowntimeRemoved
}

View File

@ -6,70 +6,69 @@
object Host "localhost" {
import "linux-server",
display_name = "localhost",
services["icinga"] = {
templates = [ "generic-service" ],
check_command = "icinga"
},
services["ping4"] = {
templates = [ "generic-service" ],
check_command = "ping4"
},
services["ping6"] = {
templates = [ "generic-service" ],
check_command = "ping6"
},
services["http"] = {
templates = [ "generic-service" ],
check_command = "http_ip"
},
services["ssh"] = {
templates = [ "generic-service" ],
check_command = "ssh"
},
services["load"] = {
templates = [ "generic-service" ],
check_command = "load",
scheduled_downtimes["backup"] = {
templates = [ "backup-downtime" ]
}
},
services["processes"] = {
templates = [ "generic-service" ],
check_command = "processes"
},
services["users"] = {
templates = [ "generic-service" ],
check_command = "users"
},
services["disk"] = {
templates = [ "generic-service" ],
check_command = "disk"
},
macros = {
address = "127.0.0.1",
address6 = "::1",
},
check = "ping4",
macros.address = "127.0.0.1",
macros.address6 = "::1"
}
apply Service "icinga" {
import "generic-service",
check_command = "icinga",
assign where host.name == "localhost"
}
apply Service "http" {
import "generic-service",
check_command = "http_ip",
assign where host.name == "localhost"
}
apply Service "ssh" {
import "generic-service",
check_command = "ssh",
assign where host.name == "localhost"
}
apply Service "load" {
import "generic-service",
check_command = "load",
assign where host.name == "localhost"
}
apply ScheduledDowntime "backup-downtime" {
import "backup-downtime",
assign where service.host == "localhost" && service.short_name == "load"
}
apply Service "processes" {
import "generic-service",
check_command = "processes",
assign where host.name == "localhost"
}
apply Service "users" {
import "generic-service",
check_command = "users",
assign where host.name == "localhost"
}
apply Service "disk" {
import "generic-service",
check_command = "disk",
assign where host.name == "localhost"
}

View File

@ -420,6 +420,8 @@ Value AExpression::OpIndexer(const AExpression *expr, const Dictionary::Ptr& loc
BOOST_THROW_EXCEPTION(ConfigError("Tried to access invalid property '" + index + "'"));
return object->GetField(field);
} else if (value.IsEmpty()) {
return Empty;
} else {
BOOST_THROW_EXCEPTION(ConfigError("Dot operator cannot be applied to type '" + value.GetTypeName() + "'"));
}

View File

@ -146,6 +146,7 @@ using namespace icinga;
%token T_IMPORT "import (T_IMPORT)"
%token T_ASSIGN "assign (T_ASSIGN)"
%token T_IGNORE "ignore (T_IGNORE)"
%type <text> identifier
%type <array> rterm_items
%type <array> rterm_items_inner
@ -160,19 +161,20 @@ using namespace icinga;
%type <variant> rterm_scope
%type <variant> lterm
%type <num> variable_decl
%left T_LOGICAL_OR
%left T_LOGICAL_AND
%left T_IN
%left T_NOT_IN
%nonassoc T_EQUAL
%nonassoc T_NOT_EQUAL
%nonassoc T_IN
%nonassoc T_NOT_IN
%left T_PLUS T_MINUS
%left T_MULTIPLY T_DIVIDE_OP
%left T_BINARY_AND
%left T_BINARY_OR
%left '.'
%right '~'
%right '!'
%left '.'
%{
int yylex(YYSTYPE *lvalp, YYLTYPE *llocp, void *scanner);
@ -731,7 +733,7 @@ apply:
String name = aname->Evaluate(m_ModuleScope);
if (!ApplyRule::IsValidType(type))
BOOST_THROW_EXCEPTION(ConfigError("'apply' cannot be used with type '" + type + "'") << errinfo_debuginfo(@2));
BOOST_THROW_EXCEPTION(ConfigError("'apply' cannot be used with type '" + type + "'") << errinfo_debuginfo(DebugInfoRange(@2, @3)));
AExpression::Ptr exprl = static_cast<AExpression::Ptr>(*$5);
delete $5;