First review of notification script changes

refs #5170
This commit is contained in:
Michael Friedrich 2017-04-28 17:40:42 +02:00
parent 82a5c5a624
commit 91ab8551c7
4 changed files with 24 additions and 20 deletions

View File

@ -12,9 +12,11 @@ apply Notification "mail-icingaadmin" to Host {
import "mail-host-notification" import "mail-host-notification"
user_groups = host.vars.notification.mail.groups user_groups = host.vars.notification.mail.groups
users = host.vars.notification.mail.users users = host.vars.notification.mail.users
interval = 2h
//interval = 2h
vars.notification_logtosyslog = true vars.notification_logtosyslog = true
assign where host.vars.notification.mail assign where host.vars.notification.mail
} }
@ -22,8 +24,10 @@ apply Notification "mail-icingaadmin" to Service {
import "mail-service-notification" import "mail-service-notification"
user_groups = host.vars.notification.mail.groups user_groups = host.vars.notification.mail.groups
users = host.vars.notification.mail.users users = host.vars.notification.mail.users
interval = 2h
//interval = 2h
vars.notification_logtosyslog = true vars.notification_logtosyslog = true
assign where host.vars.notification.mail assign where host.vars.notification.mail
} }

View File

@ -68,7 +68,7 @@ template Notification "mail-host-notification" {
template Notification "mail-service-notification" { template Notification "mail-service-notification" {
command = "mail-service-notification" command = "mail-service-notification"
states = [ Critical, OK, Unknown, Warning ] states = [ OK, Warning, Critical, Unknown ]
types = [ Problem, Acknowledgement, Recovery, Custom, types = [ Problem, Acknowledgement, Recovery, Custom,
FlappingStart, FlappingEnd, FlappingStart, FlappingEnd,
DowntimeStart, DowntimeEnd, DowntimeRemoved ] DowntimeStart, DowntimeEnd, DowntimeRemoved ]

View File

@ -12,7 +12,7 @@ fi
Usage() { Usage() {
cat << EOF cat << EOF
The following are mandatory: Required parameters:
-4 HOSTADDRESS (\$address$) -4 HOSTADDRESS (\$address$)
-6 HOSTADDRESS6 (\$address6$) -6 HOSTADDRESS6 (\$address6$)
-d LONGDATETIME (\$icinga.long_date_time$) -d LONGDATETIME (\$icinga.long_date_time$)
@ -23,7 +23,7 @@ The following are mandatory:
-s HOSTSTATE (\$host.state$) -s HOSTSTATE (\$host.state$)
-t NOTIFICATIONTYPE (\$notification.type$) -t NOTIFICATIONTYPE (\$notification.type$)
And these are optional: Optional parameters:
-b NOTIFICATIONAUTHORNAME (\$notification.author$) -b NOTIFICATIONAUTHORNAME (\$notification.author$)
-c NOTIFICATIONCOMMENT (\$notification.comment$) -c NOTIFICATIONCOMMENT (\$notification.comment$)
-i ICINGAWEB2URL (\$notification_icingaweb2url$, Default: unset) -i ICINGAWEB2URL (\$notification_icingaweb2url$, Default: unset)
@ -71,20 +71,20 @@ SUBJECT="[$NOTIFICATIONTYPE] Host $HOSTDISPLAYNAME is $HOSTSTATE!"
NOTIFICATION_MESSAGE=`cat << EOF NOTIFICATION_MESSAGE=`cat << EOF
***** Icinga 2 Host Monitoring on $HOSTNAME ***** ***** Icinga 2 Host Monitoring on $HOSTNAME *****
==> $HOSTDISPLAYNAME ($HOSTALIAS) is $HOSTSTATE! <== ==> $HOSTDISPLAYNAME ($HOSTNAME) is $HOSTSTATE! <==
Info? $HOSTOUTPUT Info: $HOSTOUTPUT
When? $LONGDATETIME When: $LONGDATETIME
Host? $HOSTALIAS (aka "$HOSTDISPLAYNAME") Host: $HOSTNAME (Display Name: "$HOSTDISPLAYNAME")
IPv4? $HOSTADDRESS IPv4: $HOSTADDRESS
EOF EOF
` `
## Is this host IPv6 capable? Put its address into the message. ## Is this host IPv6 capable? Put its address into the message.
if [ -n "$HOSTADDRESS6" ] ; then if [ -n "$HOSTADDRESS6" ] ; then
NOTIFICATION_MESSAGE="$NOTIFICATION_MESSAGE NOTIFICATION_MESSAGE="$NOTIFICATION_MESSAGE
IPv6? $HOSTADDRESS6" IPv6: $HOSTADDRESS6"
fi fi
## Are there any comments? Put them into the message. ## Are there any comments? Put them into the message.
@ -99,7 +99,7 @@ fi
if [ -n "$ICINGAWEB2URL" ] ; then if [ -n "$ICINGAWEB2URL" ] ; then
NOTIFICATION_MESSAGE="$NOTIFICATION_MESSAGE NOTIFICATION_MESSAGE="$NOTIFICATION_MESSAGE
Get live status: URL:
$ICINGAWEB2URL/monitoring/host/show?host=$HOSTALIAS" $ICINGAWEB2URL/monitoring/host/show?host=$HOSTALIAS"
fi fi

View File

@ -12,7 +12,7 @@ fi
Usage() { Usage() {
cat << EOF cat << EOF
The following are mandatory: Required parameters:
-4 HOSTADDRESS (\$address$) -4 HOSTADDRESS (\$address$)
-6 HOSTADDRESS (\$address6$) -6 HOSTADDRESS (\$address6$)
-d LONGDATETIME (\$icinga.long_date_time$) -d LONGDATETIME (\$icinga.long_date_time$)
@ -25,7 +25,7 @@ The following are mandatory:
-t NOTIFICATIONTYPE (\$notification.type$) -t NOTIFICATIONTYPE (\$notification.type$)
-u SERVICEDISPLAYNAME (\$service.display_name$) -u SERVICEDISPLAYNAME (\$service.display_name$)
And these are optional: Optional parameters:
-b NOTIFICATIONAUTHORNAME (\$notification.author$) -b NOTIFICATIONAUTHORNAME (\$notification.author$)
-c NOTIFICATIONCOMMENT (\$notification.comment$) -c NOTIFICATIONCOMMENT (\$notification.comment$)
-i ICINGAWEB2URL (\$notification_icingaweb2url$, Default: unset) -i ICINGAWEB2URL (\$notification_icingaweb2url$, Default: unset)
@ -76,19 +76,19 @@ NOTIFICATION_MESSAGE=`cat << EOF
==> $SERVICEDISPLAYNAME on $HOSTDISPLAYNAME is $SERVICESTATE! <== ==> $SERVICEDISPLAYNAME on $HOSTDISPLAYNAME is $SERVICESTATE! <==
Info? $SERVICEOUTPUT Info: $SERVICEOUTPUT
When? $LONGDATETIME When: $LONGDATETIME
Service? $SERVICENAME (aka "$SERVICEDISPLAYNAME") Service: $SERVICENAME (Display Name: "$SERVICEDISPLAYNAME")
Host? $HOSTALIAS (aka "$HOSTDISPLAYNAME") Host: $HOSTNAME (Display Name: "$HOSTDISPLAYNAME")
IPv4? $HOSTADDRESS IPv4: $HOSTADDRESS
EOF EOF
` `
## Is this host IPv6 capable? Put its address into the message. ## Is this host IPv6 capable? Put its address into the message.
if [ -n "$HOSTADDRESS6" ] ; then if [ -n "$HOSTADDRESS6" ] ; then
NOTIFICATION_MESSAGE="$NOTIFICATION_MESSAGE NOTIFICATION_MESSAGE="$NOTIFICATION_MESSAGE
IPv6? $HOSTADDRESS6" IPv6: $HOSTADDRESS6"
fi fi
## Are there any comments? Put them into the message. ## Are there any comments? Put them into the message.