diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2019-04-26 16:22:17 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2019-04-26 16:22:17 +0000 |
commit | 58b482856cf37b0519e516ab8dc1105ba958f8b2 (patch) | |
tree | 0c46396e98741dfae4ce907bc8ef8c54418b3753 /health/notifications/alarm-notify.sh.in | |
parent | Adding upstream version 1.14.0~rc0. (diff) | |
download | netdata-58b482856cf37b0519e516ab8dc1105ba958f8b2.tar.xz netdata-58b482856cf37b0519e516ab8dc1105ba958f8b2.zip |
Adding upstream version 1.14.0.upstream/1.14.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'health/notifications/alarm-notify.sh.in')
-rwxr-xr-x | health/notifications/alarm-notify.sh.in | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/health/notifications/alarm-notify.sh.in b/health/notifications/alarm-notify.sh.in index 763b1d224..16e5f08ad 100755 --- a/health/notifications/alarm-notify.sh.in +++ b/health/notifications/alarm-notify.sh.in @@ -1740,7 +1740,7 @@ send_syslog() { # SMS sender send_sms() { - local recipients="${1}" exitcode sent=0 + local recipients="${1}" errcode errmessage sent=0 # Human readable SMS local msg="${host} ${status_message}: ${chart} (${family}), ${alarm}" @@ -1751,12 +1751,13 @@ send_sms() { if [ "${SEND_SMS}" = "YES" ] && [ -n "${sendsms}" ] && [ -n "${recipients}" ] && [ -n "${msg}" ]; then # http://api.kavenegar.com/v1/{API-KEY}/sms/send.json for phone in ${recipients}; do - exitcode=$($sendsms $phone "$msg") - if [ ${exitcode} -eq 0 ]; then + errmessage=$($sendsms $phone "$msg" 2>&1) + errcode=$? + if [ ${errcode} -eq 0 ]; then info "sent smstools3 SMS for: ${host} ${chart}.${name} is ${status} to '${user}'" sent=$((sent + 1)) else - error "failed to send smstools3 SMS for: ${host} ${chart}.${name} is ${status} to '${user}' with error code ${exitcode}." + error "failed to send smstools3 SMS for: ${host} ${chart}.${name} is ${status} to '${user}' with error code ${errcode}: ${errmessage}." fi done |