From: Frank Brehm Date: Thu, 21 Sep 2017 20:43:00 +0000 (+0200) Subject: committing changes in /etc after apt run X-Git-Url: https://git.uhu-banane.de/?a=commitdiff_plain;h=307a04256dc68d8352eff46de04ab26711552389;p=config%2Fns1%2Fetc.git committing changes in /etc after apt run Package changes: -icinga2 2.6.0-2 amd64 -icinga2-bin 2.6.0-2 amd64 -icinga2-classicui 2.6.0-2 all -icinga2-common 2.6.0-2 all +icinga2 2.7.1-1.stretch amd64 +icinga2-bin 2.7.1-1.stretch amd64 +icinga2-classicui 2.7.1-1.stretch all +icinga2-common 2.7.1-1.stretch all -libicinga2 2.6.0-2 amd64 +libicinga2 2.7.1-1.stretch amd64 -libperl5.24 5.24.1-3+deb9u1 amd64 +libperl5.24 5.24.1-3+deb9u2 amd64 -perl 5.24.1-3+deb9u1 amd64 -perl-base 5.24.1-3+deb9u1 amd64 +perl 5.24.1-3+deb9u2 amd64 +perl-base 5.24.1-3+deb9u2 amd64 -perl-modules-5.24 5.24.1-3+deb9u1 all +perl-modules-5.24 5.24.1-3+deb9u2 all -vim-icinga2 2.6.0-2 all +vim-icinga2 2.7.1-1.stretch all --- diff --git a/icinga2/conf.d/commands.conf b/icinga2/conf.d/commands.conf index e97b087..9c51538 100644 --- a/icinga2/conf.d/commands.conf +++ b/icinga2/conf.d/commands.conf @@ -1,11 +1,157 @@ /* Command objects */ +/* Notification Commands + * + * Please check the documentation for all required and + * optional parameters. + */ + +object NotificationCommand "mail-host-notification" { + command = [ SysconfDir + "/icinga2/scripts/mail-host-notification.sh" ] + + arguments += { + "-4" = "$notification_address$" + "-6" = "$notification_address6$" + "-b" = "$notification_author$" + "-c" = "$notification_comment$" + "-d" = { + required = true + value = "$notification_date$" + } + "-f" = { + value = "$notification_from$" + description = "Set from address. Requires GNU mailutils (Debian/Ubuntu) or mailx (RHEL/SUSE)" + } + "-i" = "$notification_icingaweb2url$" + "-l" = { + required = true + value = "$notification_hostname$" + } + "-n" = { + required = true + value = "$notification_hostdisplayname$" + } + "-o" = { + required = true + value = "$notification_hostoutput$" + } + "-r" = { + required = true + value = "$notification_useremail$" + } + "-s" = { + required = true + value = "$notification_hoststate$" + } + "-t" = { + required = true + value = "$notification_type$" + } + "-v" = "$notification_logtosyslog$" + } + + vars += { + notification_address = "$address$" + notification_address6 = "$address6$" + notification_author = "$notification.author$" + notification_comment = "$notification.comment$" + notification_type = "$notification.type$" + notification_date = "$icinga.long_date_time$" + notification_hostname = "$host.name$" + notification_hostdisplayname = "$host.display_name$" + notification_hostoutput = "$host.output$" + notification_hoststate = "$host.state$" + notification_useremail = "$user.email$" + } +} + +object NotificationCommand "mail-service-notification" { + command = [ SysconfDir + "/icinga2/scripts/mail-service-notification.sh" ] + + arguments += { + "-4" = "$notification_address$" + "-6" = "$notification_address6$" + "-b" = "$notification_author$" + "-c" = "$notification_comment$" + "-d" = { + required = true + value = "$notification_date$" + } + "-e" = { + required = true + value = "$notification_servicename$" + } + "-f" = { + value = "$notification_from$" + description = "Set from address. Requires GNU mailutils (Debian/Ubuntu) or mailx (RHEL/SUSE)" + } + "-i" = "$notification_icingaweb2url$" + "-l" = { + required = true + value = "$notification_hostname$" + } + "-n" = { + required = true + value = "$notification_hostdisplayname$" + } + "-o" = { + required = true + value = "$notification_serviceoutput$" + } + "-r" = { + required = true + value = "$notification_useremail$" + } + "-s" = { + required = true + value = "$notification_servicestate$" + } + "-t" = { + required = true + value = "$notification_type$" + } + "-u" = { + required = true + value = "$notification_servicedisplayname$" + } + "-v" = "$notification_logtosyslog$" + } + + vars += { + notification_address = "$address$" + notification_address6 = "$address6$" + notification_author = "$notification.author$" + notification_comment = "$notification.comment$" + notification_type = "$notification.type$" + notification_date = "$icinga.long_date_time$" + notification_hostname = "$host.name$" + notification_hostdisplayname = "$host.display_name$" + notification_servicename = "$service.name$" + notification_serviceoutput = "$service.output$" + notification_servicestate = "$service.state$" + notification_useremail = "$user.email$" + notification_servicedisplayname = "$service.display_name$" + } +} + +/* + * If you prefer to use the notification scripts with environment + * variables instead of command line parameters, you can use + * the following commands. They have been updated from < 2.7 + * to support the new notification scripts and should help + * with an upgrade. + * Remove the comment blocks and comment the notification commands above. + */ + +/* + object NotificationCommand "mail-host-notification" { command = [ SysconfDir + "/icinga2/scripts/mail-host-notification.sh" ] env = { NOTIFICATIONTYPE = "$notification.type$" - HOSTALIAS = "$host.display_name$" + HOSTDISPLAYNAME = "$host.display_name$" + HOSTNAME = "$host.name$" HOSTADDRESS = "$address$" HOSTSTATE = "$host.state$" LONGDATETIME = "$icinga.long_date_time$" @@ -22,8 +168,9 @@ object NotificationCommand "mail-service-notification" { env = { NOTIFICATIONTYPE = "$notification.type$" - SERVICEDESC = "$service.name$" - HOSTALIAS = "$host.display_name$" + SERVICENAME = "$service.name$" + HOSTNAME = "$host.name$" + HOSTDISPLAYNAME = "$host.display_name$" HOSTADDRESS = "$address$" SERVICESTATE = "$service.state$" LONGDATETIME = "$icinga.long_date_time$" @@ -36,3 +183,5 @@ object NotificationCommand "mail-service-notification" { } } +*/ + diff --git a/icinga2/conf.d/notifications.conf b/icinga2/conf.d/notifications.conf index 73f0f5f..6a7e1f5 100644 --- a/icinga2/conf.d/notifications.conf +++ b/icinga2/conf.d/notifications.conf @@ -10,18 +10,24 @@ apply Notification "mail-icingaadmin" to Host { import "mail-host-notification" - user_groups = host.vars.notification.mail.groups users = host.vars.notification.mail.users + //interval = 2h + + //vars.notification_logtosyslog = true + assign where host.vars.notification.mail } apply Notification "mail-icingaadmin" to Service { import "mail-service-notification" - user_groups = host.vars.notification.mail.groups users = host.vars.notification.mail.users + //interval = 2h + + //vars.notification_logtosyslog = true + assign where host.vars.notification.mail } diff --git a/icinga2/conf.d/templates.conf b/icinga2/conf.d/templates.conf index 3588f7f..5655e3f 100644 --- a/icinga2/conf.d/templates.conf +++ b/icinga2/conf.d/templates.conf @@ -51,6 +51,12 @@ template Notification "mail-host-notification" { FlappingStart, FlappingEnd, DowntimeStart, DowntimeEnd, DowntimeRemoved ] + vars += { + // notification_icingaweb2url = "https://www.example.com/icingaweb2" + // notification_from = "Icinga 2 Host Monitoring " + notification_logtosyslog = false + } + period = "24x7" } @@ -67,6 +73,11 @@ template Notification "mail-service-notification" { FlappingStart, FlappingEnd, DowntimeStart, DowntimeEnd, DowntimeRemoved ] + vars += { + // notification_icingaweb2url = "https://www.example.com/icingaweb2" + // notification_from = "Icinga 2 Service Monitoring " + notification_logtosyslog = false + } + period = "24x7" } - diff --git a/icinga2/features-available/influxdb.conf b/icinga2/features-available/influxdb.conf index 058568b..20f9ed2 100644 --- a/icinga2/features-available/influxdb.conf +++ b/icinga2/features-available/influxdb.conf @@ -9,6 +9,8 @@ object InfluxdbWriter "influxdb" { //host = "127.0.0.1" //port = 8086 //database = "icinga2" + //flush_threshold = 1024 + //flush_interval = 10s //host_template = { // measurement = "$host.check_command$" // tags = { diff --git a/icinga2/scripts/mail-host-notification.sh b/icinga2/scripts/mail-host-notification.sh index e1ac716..d6e22ce 100755 --- a/icinga2/scripts/mail-host-notification.sh +++ b/icinga2/scripts/mail-host-notification.sh @@ -1,20 +1,156 @@ -#!/bin/sh -template=`cat <