Skip to content

Commit

Permalink
Merge pull request #119 from adfinis/feat/sla_team
Browse files Browse the repository at this point in the history
Add option to pass additional/custom information to notification scripts
  • Loading branch information
martinwe-adfinis authored Aug 28, 2023
2 parents 2e27ff4 + 59eed58 commit 3a596f7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ account_sid="{{ icinga2_master_twilio_account_sid }}"
auth_token="{{ icinga2_master_twilio_auth_token }}"
phone_number="{{ icinga2_master_twilio_sms_from }}"

PROG="$(basename "$0")"
PROG=${0##*/}

## Function helpers
Usage() {
Expand All @@ -29,8 +29,8 @@ Required parameters:
Optional parameters:
-b NOTIFICATIONAUTHORNAME (\$notification.author\$)
-i ICINGAWEB2URL (\$notification_icingaweb2url\$, Default: unset)
-r USERPHONE (\$user.pager\$)
-v (\$notification_sendtosyslog\$, Default: false)
-X (\$notification_extradata\$, Default: unset)
EOF
}
Expand Down Expand Up @@ -61,7 +61,8 @@ urlencode() {
{% endraw %}

## Main
while getopts d:hi:l:n:o:r:s:t:v: opt
EXTRA_DATA=
while getopts d:hi:l:n:o:r:s:t:v:X: opt
do
case "$opt" in
d) LONGDATETIME=$OPTARG ;; # required
Expand All @@ -74,6 +75,7 @@ do
s) HOSTSTATE=$OPTARG ;; # required
t) NOTIFICATIONTYPE=$OPTARG ;; # required
v) VERBOSE=$OPTARG ;;
X) EXTRA_DATA=$OPTARG ;;
\?) echo "ERROR: Invalid option -$OPTARG" >&2
Error ;;
:) echo "Missing option argument for -$OPTARG" >&2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ account_sid="{{ icinga2_master_twilio_account_sid }}"
auth_token="{{ icinga2_master_twilio_auth_token }}"
phone_number="{{ icinga2_master_twilio_sms_from }}"

PROG="$(basename "$0")"
PROG=${0##*/}

## Function helpers
Usage() {
Expand All @@ -30,8 +30,8 @@ Required parameters:
Optional parameters:
-i ICINGAWEB2URL (\$notification_icingaweb2url\$, Default: unset)
-r USERPHONE (\$user.pager\$)
-v (\$notification_sendtosyslog\$, Default: false)
-X EXTRA_DATA (\$notification_extradata\$, Default: unset)
EOF
}
Expand Down Expand Up @@ -62,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 @@ -77,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 3a596f7

Please sign in to comment.