@cryptotaxi247 / netdata-1 / commits / e847bdb3d

allow configuring the user sending email notifications; fixes #2548

Costa Tsaousis (ktsaou) committed Aug 3, 2017 at 00:56 UTC e847bdb3d52353856d4aaae438e3969aa0ca104d
2 files changed +8
conf.d/health_alarm_notify.conf
+4
@@ -94,6 +94,10 @@ curl=""
94 # multiple recipients can be given like this:
95 # "admin1@example.com admin2@example.com ..."
96
97 +# the email address sending email notifications
98 +# the default is the system user netdata runs as (usually: netdata)
99 +EMAIL_SENDER=""
100 +
101 # enable/disable sending emails
102 SEND_EMAIL="YES"
103
plugins.d/alarm-notify.sh
+4
@@ -288,6 +288,7 @@ DEFAULT_RECIPIENT_CUSTOM=
288 declare -A role_recipients_custom=()
289
290 # email configs
291 +EMAIL_SENDER=""
292 DEFAULT_RECIPIENT_EMAIL="root"
293 declare -A role_recipients_email=()
294
@@ -1388,7 +1389,10 @@ SENT_HIPCHAT=$?
1389 # -----------------------------------------------------------------------------
1390 # send the email
1391
1392 +[ -z "${EMAIL_SENDER}" ] && EMAIL_SENDER="${USER-netdata}"
1393 +
1394 send_email <<EOF
1395 +From: ${EMAIL_SENDER}
1396 To: ${to_email}
1397 Subject: ${host} ${status_message} - ${name//_/ } - ${chart}
1398 MIME-Version: 1.0