From 43875349448a9286a25fabb0deb6045fb76d0ac0 Mon Sep 17 00:00:00 2001 From: f Date: Sun, 13 Mar 2022 23:27:39 -0300 Subject: [PATCH] mmonit support --- Dockerfile | 4 ++-- monitrc | 4 ++-- email.conf => zeroconf.conf | 1 + email.sh => zeroconf.sh | 6 ++++-- 4 files changed, 9 insertions(+), 6 deletions(-) rename email.conf => zeroconf.conf (84%) rename email.sh => zeroconf.sh (57%) diff --git a/Dockerfile b/Dockerfile index bf34f7a..4032b87 100644 --- a/Dockerfile +++ b/Dockerfile @@ -34,8 +34,8 @@ RUN install -dm 2750 -o root -g root /var/lib/monit COPY --from=build /etc/monitrc /etc/monitrc COPY ./nsupdate.sh /usr/local/bin/nsupdate COPY ./whatsmyip6.sh /usr/local/bin/whatsmyip6 -COPY ./email.sh /usr/local/bin/email -COPY ./email.conf /etc/email.conf +COPY ./zeroconf.sh /usr/local/bin/zeroconf +COPY ./zeroconf.conf /etc/zeroconf.conf # Allow access to the web GUI EXPOSE 2812 diff --git a/monitrc b/monitrc index 6129533..a51e485 100644 --- a/monitrc +++ b/monitrc @@ -17,8 +17,8 @@ check program nsupdate every 1 cycle if status = 0 then unmonitor -check program email - with path "/usr/local/bin/email" +check program zeroconf + with path "/usr/local/bin/zeroconf" every 1 cycle if status = 0 then unmonitor diff --git a/email.conf b/zeroconf.conf similarity index 84% rename from email.conf rename to zeroconf.conf index d5868eb..a667bec 100644 --- a/email.conf +++ b/zeroconf.conf @@ -1,3 +1,4 @@ +set mmonit http://@@MMONIT@@/collector set mailserver postfix port 25 using hostname @@HOSTNAME@@ set alert @@EMAIL@@ diff --git a/email.sh b/zeroconf.sh similarity index 57% rename from email.sh rename to zeroconf.sh index 288376b..6652aaf 100755 --- a/email.sh +++ b/zeroconf.sh @@ -1,15 +1,17 @@ #!/bin/sh set -e -test ! -f /etc/monit.d/email.conf || exit 0 +test ! -f /etc/monit.d/zeroconf.conf || exit 0 test -n "${EMAIL}" test -n "${EMAIL_FROM}" +test -n "${MMONIT}" sed -re "s/@@EMAIL@@/${EMAIL}/" \ -e "s/@@EMAIL_FROM@@/${EMAIL_FROM}/" \ -e "s/@@HOSTNAME@@/${EMAIL_FROM#*@}/" \ - /etc/email.conf > /etc/monit.d/email.conf + -e "s/@@MMONIT@@/${MMONIT}/" \ + /etc/zeroconf.conf > /etc/monit.d/zeroconf.conf monit -t monit reload