@cryptotaxi247 / netdata-1 / commits / 7ac626bb8

health: log an error if any when send email notification (#10818)

Ilya Mashchenko committed Mar 19, 2021 at 17:53 UTC 7ac626bb8148976cdaa78baae4de2c1a9a81b898
1 file changed +3 -2
health/notifications/alarm-notify.sh.in
+3 -2
@@ -885,14 +885,15 @@ send_email() {
885 echo >&2 "--- END sendmail command ---"
886 fi
887
888 - "${sendmail}" -t "${opts[@]}"
888 + local cmd_output
889 + cmd_output=$("${sendmail}" -t "${opts[@]}" 2>&1)
890 ret=$?
891
892 if [ ${ret} -eq 0 ]; then
893 info "sent email notification for: ${host} ${chart}.${name} is ${status} to '${to_email}'"
894 return 0
895 else
895 - error "failed to send email notification for: ${host} ${chart}.${name} is ${status} to '${to_email}' with error code ${ret}."
896 + error "failed to send email notification for: ${host} ${chart}.${name} is ${status} to '${to_email}' with error code ${ret} (${cmd_output})."
897 return 1
898 fi
899 fi