Skip to content

Commit

Permalink
SMS notifications: Add -X for passing extra information
Browse files Browse the repository at this point in the history
While it has no immediate effect in this script itself, it allows
playbook authors to do more interesting things for generating the
message.

One could e.g. pass the team name or other meta information from
Icinga2, and then the script could forward the message to relevant chat
channels.
  • Loading branch information
martinwe-adfinis committed Aug 21, 2023
1 parent 306fc96 commit 2c4bc8e
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ Required parameters:
Optional parameters:
-i ICINGAWEB2URL (\$notification_icingaweb2url\$, Default: unset)
-v (\$notification_sendtosyslog\$, Default: false)
-X EXTRA_DATA (\$notification_extradata\$, Default: unset)
EOF
}
Expand Down Expand Up @@ -61,7 +62,8 @@ urlencode() {
{% endraw %}

## Main
while getopts d:e:hi:l:n:o:r:s:t:u:v: opt
EXTRA_DATA=
while getopts d:e:hi:l:n:o:r:s:t:u:v:X: opt
do
case "$opt" in
d) LONGDATETIME=$OPTARG ;; # required
Expand All @@ -76,6 +78,7 @@ do
t) NOTIFICATIONTYPE=$OPTARG ;; # required
u) SERVICEDISPLAYNAME=$OPTARG ;; # required
v) VERBOSE=$OPTARG ;;
X) EXTRA_DATA=$OPTARG ;;
\?) echo "ERROR: Invalid option -$OPTARG" >&2
Usage ;;
:) echo "Missing option argument for -$OPTARG" >&2
Expand Down

0 comments on commit 2c4bc8e

Please sign in to comment.