From 58b482856cf37b0519e516ab8dc1105ba958f8b2 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 26 Apr 2019 18:22:17 +0200 Subject: Adding upstream version 1.14.0. Signed-off-by: Daniel Baumann --- health/notifications/alarm-notify.sh.in | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'health/notifications/alarm-notify.sh.in') 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 -- cgit v1.2.3