From c88f6adeb932998772b12545b7ace69578275150 Mon Sep 17 00:00:00 2001 From: Michael Lewkowski Date: Wed, 1 Jun 2016 09:03:54 +0200 Subject: exported smtp_message as configuration parameter --- start-munin.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/start-munin.sh b/start-munin.sh index a7209f7..58b3d0a 100644 --- a/start-munin.sh +++ b/start-munin.sh @@ -6,6 +6,8 @@ MUNIN_PASSWORD=${MUNIN_PASSWORD:-password} MAIL_CONF_PATH='/var/lib/munin/.mailrc' SMTP_USE_TLS=${SMTP_USE_TLS:-false} SMTP_ALWAYS_SEND=${SMTP_ALWAYS_SEND:-true} +SMTP_MESSAGE_DEFAULT='[${var:group};${var:host}] -> ${var:graph_title} -> warnings: ${loop<,>:wfields ${var:label}=${var:value}} / criticals: ${loop<,>:cfields ${var:label}=${var:value}}' +SMTP_MESSAGE="${SMTP_MESSAGE:-$SMTP_MESSAGE_DEFAULT}" truncate -s 0 "${MAIL_CONF_PATH}" @@ -33,7 +35,7 @@ fi 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 + echo "contact.mail.command mail -r ${ALERT_SENDER} -s ${SMTP_MESSAGE} ${ALERT_RECIPIENT}" >> /etc/munin/munin.conf if [ "${SMTP_ALWAYS_SEND}" = true ] ; then echo 'contact.mail.always_send warning critical' >> /etc/munin/munin.conf fi -- cgit v1.2.3