Add example notifications (users, notifications, groups).

fixes #4842
This commit is contained in:
Michael Friedrich 2013-10-16 01:01:32 +02:00
parent 91afc36b3a
commit 0650832018
7 changed files with 163 additions and 1 deletions

View File

@ -5,9 +5,12 @@ icinga2confdir = $(DESTDIR)${sysconfdir}/icinga2/conf.d
CONFIG_FILES = \
generic-host.conf \
generic-service.conf \
groups.conf \
localhost.conf \
macros.conf \
timeperiods.conf
notifications.conf \
timeperiods.conf \
users.conf
install-data-local:
@if [ ! -e $(icinga2confdir) ]; then \

View File

@ -5,3 +5,49 @@
template Host "generic-host" {
}
template Host "linux-server" inherits "generic-host" {
groups = [ "linux-servers" ],
services["ping4"] = {
templates = [ "generic-service" ],
check_command = "ping4"
},
check = "ping4"
}
template Host "windows-server" inherits "generic-host" {
groups = [ "windows-servers" ],
services["ping4"] = {
templates = [ "generic-service" ],
check_command = "ping4"
},
check = "ping4"
}
template Host "generic-printer" inherits "generic-host" {
services["ping4"] = {
templates = [ "generic-service" ],
check_command = "ping4"
},
check = "ping4"
}
template Host "generic-switch" inherits "generic-host" {
services["ping4"] = {
templates = [ "generic-service" ],
check_command = "ping4"
},
check = "ping4"
}

View File

@ -4,4 +4,12 @@
*/
template Service "generic-service" {
max_check_attempts = 3,
check_interval = 5m,
retry_interval = 1m,
notifications["mail-icingaadmin"] = {
templates = [ "mail-notification" ],
user_groups = [ "icingaadmins" ]
}
}

View File

@ -0,0 +1,11 @@
/**
* Host and service group examples.
*/
object HostGroup "linux-servers" {
display_name = "Linux Servers"
}
object HostGroup "windows-servers" {
display_name = "Windows Servers"
}

View File

@ -4,6 +4,11 @@
* files in this directory are included.
*/
object Host "localhost" inherits "generic-host" {
display_name = "localhost",
groups = [ "linux-servers", "windows-servers" ],
services["ping4"] = {
templates = [ "generic-service" ],

View File

@ -0,0 +1,49 @@
/**
* The example notification templates.
*/
template Notification "mail-notification" {
notification_command = "mail-service-notification",
notification_state_filter = (StateFilterWarning |
StateFilterCritical |
StateFilterUnknown),
notification_type_filter = (NotificationFilterProblem |
NotificationFilterAcknowledgement |
NotificationFilterRecovery |
NotificationFilterCustom |
NotificationFilterFlappingStart |
NotificationFilterFlappingEnd |
NotificationFilterDowntimeStart |
NotificationFilterDowntimeEnd |
NotificationFilterDowntimeRemoved),
notification_period = "24x7",
users = [ "icingaadmin" ],
usergroups = [ "icingaadmins" ]
}
object NotificationCommand "mail-service-notification" inherits "plugin-notification-command" {
command = [
"/usr/bin/printf",
"\"%b\"",
{{{\"***** Icinga *****
Notification Type: $NOTIFICATIONTYPE$
Service: $SERVICEDESC$
Host: $HOSTALIAS$
Address: $HOSTADDRESS$
State: $SERVICESTATE$
Date/Time: $LONGDATETIME$
Additional Info: $SERVICEOUTPUT$
Comment: [$NOTIFICATIONAUTHORNAME$] $NOTIFICATIONCOMMENT$\"}}},
"-s",
"\"$NOTIFICATIONTYPE$ - $HOSTDISPLAYNAME$ - $SERVICEDISPLAYNAME$ is $SERVICESTATE$\"",
"$USEREMAIL$"
]
}

View File

@ -0,0 +1,40 @@
/**
* The example user 'icingaadmin' and the example
* group 'icingaadmins'.
*/
object User "icingaadmin" {
display_name = "Icinga 2 Admin",
groups = [ "icingaadmins" ],
enable_notifications = 1,
notification_period = "24x7",
notification_state_filter = (StateFilterWarning |
StateFilterCritical |
StateFilterUnknown),
notification_type_filter = (NotificationFilterProblem |
NotificationFilterAcknowledgement |
NotificationFilterRecovery |
NotificationFilterCustom |
NotificationFilterFlappingStart |
NotificationFilterFlappingEnd |
NotificationFilterDowntimeStart |
NotificationFilterDowntimeEnd |
NotificationFilterDowntimeRemoved),
macros = {
"name" = "Icinga 2 Admin",
"email" = "icinga@localhost",
"pager" = "icingaadmin@localhost.localdomain"
},
custom = {
notes = "This is the Icinga 2 Admin account.",
}
}
object UserGroup "icingaadmins" {
display_name = "Icinga 2 Admin Group"
}