From 6a64d0d18ab0299e4c5821b75090da506bcfeaec Mon Sep 17 00:00:00 2001 From: Michael Lewkowski Date: Wed, 1 Jun 2016 08:27:17 +0200 Subject: added smtp_always_send parameter; documented smtp_always_send and smtp_use_tls parameters --- README.md | 4 ++++ start-munin.sh | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/README.md b/README.md index 90bd619..c01c366 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,8 @@ Email credentials used to send emails (like alerts) * `SMTP_PORT` * `SMTP_USERNAME` * `SMTP_PASSWORD` +* `SMTP_USE_TLS` +* `SMTP_ALWAYS_SEND` ### Alert target @@ -63,6 +65,8 @@ docker run -d \ -e SMTP_PORT=587 \ -e SMTP_USERNAME=smtp-username \ -e SMTP_PASSWORD=smtp-password \ + -e SMTP_USE_TLS=false \ + -e SMTP_ALWAYS_SEND=true \ -e ALERT_RECIPIENT=monitoring@example.com \ -e ALERT_SENDER=alerts@example.com \ -e NODES="server1:10.0.0.1 server2:10.0.0.2" \ diff --git a/start-munin.sh b/start-munin.sh index bed2e80..e994128 100644 --- a/start-munin.sh +++ b/start-munin.sh @@ -5,6 +5,7 @@ MUNIN_USER=${MUNIN_USER:-user} MUNIN_PASSWORD=${MUNIN_PASSWORD:-password} MAIL_CONF_PATH='/var/lib/munin/.mailrc' SMTP_USE_TLS=false +SMTP_ALWAYS_SEND=true truncate -s 0 "${MAIL_CONF_PATH}" @@ -33,6 +34,9 @@ grep -q 'contact.mail' /etc/munin/munin.conf; rc=$? if [ $rc -ne 0 -a -n "${ALERT_RECIPIENT}" -a -n "${ALERT_SENDER}" ] ; then echo "Setup alert email from ${ALERT_SENDER} to ${ALERT_RECIPIENT}" echo 'contact.mail.command mail -r '${ALERT_SENDER}' -s "[${var:group};${var:host}] -> ${var:graph_title} -> warnings: ${loop<,>:wfields ${var:label}=${var:value}} / criticals: ${loop<,>:cfields ${var:label}=${var:value}}"' ${ALERT_RECIPIENT} >> /etc/munin/munin.conf + if [ "${SMTP_ALWAYS_SEND}" = true ] ; then + echo 'contact.mail.always_send warning critical' >> /etc/munin/munin.conf + fi fi [ -e /etc/munin/htpasswd.users ] || htpasswd -b -c /etc/munin/htpasswd.users "$MUNIN_USER" "$MUNIN_PASSWORD" -- cgit v1.2.1