icinga2/contrib/config/mf/icinga2.conf

293 lines
7.2 KiB
Plaintext

/**
* Icinga 2 configuration file
* - this is where you define settings for the Icinga application including
* which hosts/services to check.
*
* The docs/icinga2-config.txt file in the source tarball has a detailed
* description of what configuration options are available.
*/
include <itl/itl.conf>
include <itl/standalone.conf>
set IcingaMacros = {
plugindir = "/usr/lib/nagios/plugins",
iconimagedir = "/icinga2/images/icons",
icinga2src = "/home/michi/coding/icinga/icinga2",
}
set Icinga2Prefix = "/home/michi/i2"
set PerfdataPrefix = "/data/icinga2"
/**
* Enable Syslogger
*/
/*
object SyslogLogger "icinga2-syslog" {
severity = "information"
}
object FileLogger "my-debug-file" {
severity = "debug",
path = (Icinga2Prefix + "/var/log/icinga2/icinga2-debug.log")
}
*/
/**
* The compat component periodically updates the status.dat and objects.cache
* files. These are used by the Icinga 1.x CGIs to display the state of
* hosts and services.
*/
library "compat"
object StatusDataWriter "status" { }
object ExternalCommandListener "command" { }
object CompatLogger "compat-log" { }
/**
* INGRAPH
*/
object PerfdataWriter "pnp" {
perfdata_path = (PerfdataPrefix + "/perfdata/service-perfdata"),
format_template = "DATATYPE::SERVICEPERFDATA\tTIMET::$TIMET$\tHOSTNAME::$HOSTNAME$\tSERVICEDESC::$SERVICEDESC$\tSERVICEPERFDATA::$SERVICEPERFDATA$\tSERVICECHECKCOMMAND::$SERVICECHECKCOMMAND$\tHOSTSTATE::$HOSTSTATE$\tHOSTSTATETYPE::$HOSTSTATETYPE$\tSERVICESTATE::$SERVICESTATE$\tSERVICESTATETYPE::$SERVICESTATETYPE$",
rotation_interval = 15s,
}
/**
* LIVESTATUS
*/
/*
library "livestatus"
object LivestatusListener "livestatus-tcp" {
socket_type = "tcp",
bind_host = "127.0.0.1",
bind_port = "6558"
}
object LivestatusListener "livestatus-unix" {
socket_type = "unix",
socket_path = (Icinga2Prefix + "/var/run/icinga2/livestatus")
}
*/
/**
* IDO
*/
library "db_ido_mysql"
object IdoMysqlConnection "ido-mysql" {
host = "127.0.0.1",
port = "3306",
user = "icinga",
password = "icinga",
database = "icinga",
table_prefix = "icinga_",
instance_name = "icinga2",
instance_description = "icinga2 dev instance"
}
/**
* And finally we define some host that should be checked.
*/
set bumsti = 60
template Service "notification-tmpl" {
notifications["mail-michi"] = {
templates = [ "mail-notification" ],
users = [ "michi" ],
},
}
template Service "flapper" inherits "ping4" {
notifications["mail-michi"] = {
templates = [ "mail-notification" ],
users = [ "michi" ],
},
check_command = "flapme",
enable_flapping = 1,
flapping_threshold = 20,
check_interval = 15s,
custom = {
"foo1" = "bar1",
"foo5" = "bar5"
},
groups = [ "sg-thruk" ],
}
object Host "dummy01" {
groups = [ "hg-thruk" ],
services["flapme"] = {
templates = [ "flapper" ],
check_command = "flapme",
},
}
object Host "localhost" {
host_dependencies = [ "dummy01" ],
services["flapme"] = {
templates = [ "flapper" ],
notifications["mail-michi"] = {
templates = [ "mail-notification" ],
users = [ "michi" ],
groups = [ "all-michis" ],
notification_period = "24x7",
notification_state_filter = (StateFilterUnknown | StateFilterOK | StateFilterWarning | StateFilterCritical),
notification_type_filter = (NotificationRecovery | NotificationDowntimeStart | NotificationDowntimeEnd),
},
check_command = "flapme",
enable_flapping = 1,
flapping_threshold = 20,
check_interval = 15s,
custom += {
"foo1" = "bar1",
"foo2" = "bar2",
"notes" = "flapping test $SERVICEATTEMPT$ / $MAXSERVICEATTEMPT$",
"notes_url" = "https://www.icinga.org/$HOSTNAME$/$SERVICEDESC$/$TIMET$",
"action_url" = "https://dev.icinga.org/$HOSTADDRESS$/$SERVICESTATE$",
"icon_image" = "$iconimagedir$/icinga2.png",
"icon_image_alt" = "custom attr macro expand test"
},
groups = [ "sg-thruk" ],
},
services["ping4"] = {
templates = [ "ping4", "notification-tmpl" ],
},
services["ping6"] = {
templates = [ "ping6", "notification-tmpl" ],
},
services["ssh"] = {
templates = [ "ssh", "notification-tmpl" ],
},
services["load"] = {
templates = [ "load", "notification-tmpl" ],
},
services["users"] = {
templates = [ "users", "notification-tmpl" ],
groups = [ "sg-thruk" ],
service_dependencies = [
{ host = "dummy01", service = "flapme" },
],
},
macros = {
address = "127.0.0.1",
address6 = "::1",
},
custom += {
"fooh1" = "barh1",
"fooh2" = "barh2",
"notes" = "host test $SERVICEATTEMPT$ / $MAXSERVICEATTEMPT$", /* this should work with hostcheck set */
"notes_url" = "https://www.icinga.org/$HOSTNAME$/$SERVICEDESC$/$TIMET$",
"action_url" = "https://dev.icinga.org/$HOSTADDRESS$/$SERVICESTATE$",
"icon_image" = "$iconimagedir$/icinga2.png",
"icon_image_alt" = "custom attr macro expand test",
"2d_coords" = "42,1337"
},
check = "flapme",
groups = [ "hg-thruk" ],
}
object HostGroup "hg-thruk" {
display_name = "hg thruk livestatus",
custom = {
action_url = "http://www.icinga.org/about/icinga2",
notes_url = "http://docs.icinga.org/latest/en",
notes = "This is the icinga2 livestatus test"
}
}
object ServiceGroup "sg-thruk" {
display_name = "sg thruk livestatus",
custom = {
action_url = "http://www.icinga.org/about/icinga2",
notes_url = "http://docs.icinga.org/latest/en",
notes = "This is the icinga2 livestatus test"
}
}
object CheckCommand "flapme" inherits "plugin-check-command" {
command = "$icinga2src$/contrib/flap.sh",
}
object EventCommand "eventme" inherits "plugin-event-command" {
command = "echo \"event fired\"",
}
object NotificationCommand "notifyme" inherits "plugin-notification-command" {
command = "echo \"hello\"",
}
object NotificationCommand "mail" inherits "plugin-notification-command" {
command = "echo `date +%s` >> /tmp/i2.notify"
}
object User "michi-clone" {
groups = [ "all-michis" ],
}
object User "michi" {
groups = [ "all-michis" ],
notification_state_filter = (StateFilterUnknown | StateFilterOK | StateFilterWarning | StateFilterCritical),
enable_notifications = 1,
notification_period = "24x7",
macros = {
"name" = "bumsti",
"pager" = "keks@kekse.de",
"email" = "michael.friedrich@icinga.org",
},
custom = {
"cv_key01" = "cv_val01",
"cv_key03" = "cv_val03",
"cv_key07" = "cv_val07",
}
}
object UserGroup "all-michis" {
display_name = "all my michis",
}
template Notification "mail-notification" {
notification_command = "mail",
}
object TimePeriod "8x5" inherits "legacy-timeperiod" {
display_name = "icinga 2 8x5",
ranges = {
"monday" = "09:00-17:00",
"tuesday" = "09:00-17:00",
"wednesday" = "09:00-17:00",
"thursday" = "09:00-17:00",
"friday" = "09:00-17:00",
}
}
object TimePeriod "24x7" inherits "legacy-timeperiod" {
display_name = "icinga 2 24x7",
ranges = {
"monday" = "00:00-24:00",
"tuesday" = "00:00-24:00",
"wednesday" = "00:00-24:00",
"thursday" = "00:00-24:00",
"friday" = "00:00-24:00",
"saturday" = "00:00-24:00",
"sunday" = "00:00-24:00",
}
}
object TimePeriod "none" inherits "legacy-timeperiod" {
display_name = "icinga 2 none",
ranges = {
}
}