Merge pull request #9713 from Tqnsls/Tqnsls-updated-mail-notifications

Updated mail-host-notification and mail-service-notification
This commit is contained in:
Julian Brost 2023-05-19 16:34:21 +02:00 committed by GitHub
commit bead025b9c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 35 additions and 2 deletions

View File

@ -43,6 +43,7 @@ object NotificationCommand "mail-host-notification" {
required = true required = true
value = "$notification_hoststate$" value = "$notification_hoststate$"
} }
"-X" = "$notification_hostnotes$"
"-t" = { "-t" = {
required = true required = true
value = "$notification_type$" value = "$notification_type$"
@ -62,6 +63,7 @@ object NotificationCommand "mail-host-notification" {
notification_hostoutput = "$host.output$" notification_hostoutput = "$host.output$"
notification_hoststate = "$host.state$" notification_hoststate = "$host.state$"
notification_useremail = "$user.email$" notification_useremail = "$user.email$"
notification_hostnotes = "$host.notes$"
} }
} }
@ -110,6 +112,8 @@ object NotificationCommand "mail-service-notification" {
required = true required = true
value = "$notification_type$" value = "$notification_type$"
} }
"-X" = "$notification_hostnotes$"
"-x" = "$notification_servicenotes$"
"-u" = { "-u" = {
required = true required = true
value = "$notification_servicedisplayname$" value = "$notification_servicedisplayname$"
@ -131,6 +135,8 @@ object NotificationCommand "mail-service-notification" {
notification_servicestate = "$service.state$" notification_servicestate = "$service.state$"
notification_useremail = "$user.email$" notification_useremail = "$user.email$"
notification_servicedisplayname = "$service.display_name$" notification_servicedisplayname = "$service.display_name$"
notification_hostnotes = "$host.notes$"
notification_servicenotes = "$service.notes$"
} }
} }
@ -160,6 +166,7 @@ object NotificationCommand "mail-host-notification" {
NOTIFICATIONCOMMENT = "$notification.comment$" NOTIFICATIONCOMMENT = "$notification.comment$"
HOSTDISPLAYNAME = "$host.display_name$" HOSTDISPLAYNAME = "$host.display_name$"
USEREMAIL = "$user.email$" USEREMAIL = "$user.email$"
HOSTNOTES = "$host.notes$"
} }
} }
@ -180,6 +187,8 @@ object NotificationCommand "mail-service-notification" {
HOSTDISPLAYNAME = "$host.display_name$" HOSTDISPLAYNAME = "$host.display_name$"
SERVICEDISPLAYNAME = "$service.display_name$" SERVICEDISPLAYNAME = "$service.display_name$"
USEREMAIL = "$user.email$" USEREMAIL = "$user.email$"
HOSTNOTES = "$host.notes$"
SERVICENOTES = "$service.notes$"
} }
} }

View File

@ -27,6 +27,7 @@ Required parameters:
Optional parameters: Optional parameters:
-4 HOSTADDRESS (\$address\$) -4 HOSTADDRESS (\$address\$)
-6 HOSTADDRESS6 (\$address6\$) -6 HOSTADDRESS6 (\$address6\$)
-X HOSTNOTES (\$host.notes\$)
-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)
@ -63,7 +64,7 @@ urlencode() {
} }
## Main ## Main
while getopts 4:6::b:c:d:f:hi:l:n:o:r:s:t:v: opt while getopts 4:6::b:c:d:f:hi:l:n:o:r:s:t:v:X: opt
do do
case "$opt" in case "$opt" in
4) HOSTADDRESS=$OPTARG ;; 4) HOSTADDRESS=$OPTARG ;;
@ -77,6 +78,7 @@ do
l) HOSTNAME=$OPTARG ;; # required l) HOSTNAME=$OPTARG ;; # required
n) HOSTDISPLAYNAME=$OPTARG ;; # required n) HOSTDISPLAYNAME=$OPTARG ;; # required
o) HOSTOUTPUT=$OPTARG ;; # required o) HOSTOUTPUT=$OPTARG ;; # required
X) HOSTNOTES=$OPTARG ;;
r) USEREMAIL=$OPTARG ;; # required r) USEREMAIL=$OPTARG ;; # required
s) HOSTSTATE=$OPTARG ;; # required s) HOSTSTATE=$OPTARG ;; # required
t) NOTIFICATIONTYPE=$OPTARG ;; # required t) NOTIFICATIONTYPE=$OPTARG ;; # required
@ -129,6 +131,12 @@ if [ -n "$HOSTADDRESS6" ] ; then
IPv6: $HOSTADDRESS6" IPv6: $HOSTADDRESS6"
fi fi
## Check whether host notes was specified.
if [ -n "$HOSTNOTES" ] ; then
NOTIFICATION_MESSAGE="$NOTIFICATION_MESSAGE
Host notes: $HOSTNOTES"
fi
## Check whether author and comment was specified. ## Check whether author and comment was specified.
if [ -n "$NOTIFICATIONCOMMENT" ] ; then if [ -n "$NOTIFICATIONCOMMENT" ] ; then
NOTIFICATION_MESSAGE="$NOTIFICATION_MESSAGE NOTIFICATION_MESSAGE="$NOTIFICATION_MESSAGE

View File

@ -29,6 +29,8 @@ Required parameters:
Optional parameters: Optional parameters:
-4 HOSTADDRESS (\$address\$) -4 HOSTADDRESS (\$address\$)
-6 HOSTADDRESS6 (\$address6\$) -6 HOSTADDRESS6 (\$address6\$)
-X HOSTNOTES (\$host.notes\$)
-x SERVICENOTES (\$service.notes\$)
-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)
@ -65,7 +67,7 @@ urlencode() {
} }
## Main ## Main
while getopts 4:6:b:c:d:e:f:hi:l:n:o:r:s:t:u:v: opt while getopts 4:6:b:c:d:e:f:hi:l:n:o:r:s:t:u:v:X:x: opt
do do
case "$opt" in case "$opt" in
4) HOSTADDRESS=$OPTARG ;; 4) HOSTADDRESS=$OPTARG ;;
@ -79,6 +81,8 @@ do
i) ICINGAWEB2URL=$OPTARG ;; i) ICINGAWEB2URL=$OPTARG ;;
l) HOSTNAME=$OPTARG ;; # required l) HOSTNAME=$OPTARG ;; # required
n) HOSTDISPLAYNAME=$OPTARG ;; # required n) HOSTDISPLAYNAME=$OPTARG ;; # required
X) HOSTNOTES=$OPTARG ;;
x) SERVICENOTES=$OPTARG ;;
o) SERVICEOUTPUT=$OPTARG ;; # required o) SERVICEOUTPUT=$OPTARG ;; # required
r) USEREMAIL=$OPTARG ;; # required r) USEREMAIL=$OPTARG ;; # required
s) SERVICESTATE=$OPTARG ;; # required s) SERVICESTATE=$OPTARG ;; # required
@ -134,6 +138,18 @@ if [ -n "$HOSTADDRESS6" ] ; then
IPv6: $HOSTADDRESS6" IPv6: $HOSTADDRESS6"
fi fi
## Check whether host notes was specified.
if [ -n "$HOSTNOTES" ] ; then
NOTIFICATION_MESSAGE="$NOTIFICATION_MESSAGE
Host notes: $HOSTNOTES"
fi
## Check whether service notes was specified.
if [ -n "$SERVICENOTES" ] ; then
NOTIFICATION_MESSAGE="$NOTIFICATION_MESSAGE
Service notes: $SERVICENOTES"
fi
## Check whether author and comment was specified. ## Check whether author and comment was specified.
if [ -n "$NOTIFICATIONCOMMENT" ] ; then if [ -n "$NOTIFICATIONCOMMENT" ] ; then
NOTIFICATION_MESSAGE="$NOTIFICATION_MESSAGE NOTIFICATION_MESSAGE="$NOTIFICATION_MESSAGE