diff options
author | Ilya Mashchenko <ilya@netdata.cloud> | 2021-03-19 17:53:26 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-19 17:53:26 +0300 |
commit | 7ac626bb8148976cdaa78baae4de2c1a9a81b898 (patch) | |
tree | 99379a6daf7afaefb17d28e82c78cc01562e085e /health | |
parent | 2d8736f14aaa884c8d2ed90501204366c068a964 (diff) |
health: log an error if any when send email notification (#10818)
Diffstat (limited to 'health')
-rwxr-xr-x | health/notifications/alarm-notify.sh.in | 5 |
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 |