From 7ac626bb8148976cdaa78baae4de2c1a9a81b898 Mon Sep 17 00:00:00 2001 From: Ilya Mashchenko Date: Fri, 19 Mar 2021 17:53:26 +0300 Subject: health: log an error if any when send email notification (#10818) --- health/notifications/alarm-notify.sh.in | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'health/notifications') diff --git a/health/notifications/alarm-notify.sh.in b/health/notifications/alarm-notify.sh.in index 3b8fd8a1d2..7252a306e0 100755 --- a/health/notifications/alarm-notify.sh.in +++ b/health/notifications/alarm-notify.sh.in @@ -885,14 +885,15 @@ send_email() { echo >&2 "--- END sendmail command ---" fi - "${sendmail}" -t "${opts[@]}" + local cmd_output + cmd_output=$("${sendmail}" -t "${opts[@]}" 2>&1) ret=$? if [ ${ret} -eq 0 ]; then info "sent email notification for: ${host} ${chart}.${name} is ${status} to '${to_email}'" return 0 else - error "failed to send email notification for: ${host} ${chart}.${name} is ${status} to '${to_email}' with error code ${ret}." + error "failed to send email notification for: ${host} ${chart}.${name} is ${status} to '${to_email}' with error code ${ret} (${cmd_output})." return 1 fi fi -- cgit v1.2.3