summaryrefslogtreecommitdiffstats
path: root/health
diff options
context:
space:
mode:
authorIlya Mashchenko <ilya@netdata.cloud>2021-03-19 17:53:26 +0300
committerGitHub <noreply@github.com>2021-03-19 17:53:26 +0300
commit7ac626bb8148976cdaa78baae4de2c1a9a81b898 (patch)
tree99379a6daf7afaefb17d28e82c78cc01562e085e /health
parent2d8736f14aaa884c8d2ed90501204366c068a964 (diff)
health: log an error if any when send email notification (#10818)
Diffstat (limited to 'health')
-rwxr-xr-xhealth/notifications/alarm-notify.sh.in5
1 files changed, 3 insertions, 2 deletions
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