mmonit support

This commit is contained in:
f 2022-03-13 23:27:39 -03:00
parent b04c169a8e
commit 4387534944
4 changed files with 9 additions and 6 deletions

View file

@ -34,8 +34,8 @@ RUN install -dm 2750 -o root -g root /var/lib/monit
COPY --from=build /etc/monitrc /etc/monitrc COPY --from=build /etc/monitrc /etc/monitrc
COPY ./nsupdate.sh /usr/local/bin/nsupdate COPY ./nsupdate.sh /usr/local/bin/nsupdate
COPY ./whatsmyip6.sh /usr/local/bin/whatsmyip6 COPY ./whatsmyip6.sh /usr/local/bin/whatsmyip6
COPY ./email.sh /usr/local/bin/email COPY ./zeroconf.sh /usr/local/bin/zeroconf
COPY ./email.conf /etc/email.conf COPY ./zeroconf.conf /etc/zeroconf.conf
# Allow access to the web GUI # Allow access to the web GUI
EXPOSE 2812 EXPOSE 2812

View file

@ -17,8 +17,8 @@ check program nsupdate
every 1 cycle every 1 cycle
if status = 0 then unmonitor if status = 0 then unmonitor
check program email check program zeroconf
with path "/usr/local/bin/email" with path "/usr/local/bin/zeroconf"
every 1 cycle every 1 cycle
if status = 0 then unmonitor if status = 0 then unmonitor

View file

@ -1,3 +1,4 @@
set mmonit http://@@MMONIT@@/collector
set mailserver postfix port 25 using hostname @@HOSTNAME@@ set mailserver postfix port 25 using hostname @@HOSTNAME@@
set alert @@EMAIL@@ set alert @@EMAIL@@

View file

@ -1,15 +1,17 @@
#!/bin/sh #!/bin/sh
set -e 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}"
test -n "${EMAIL_FROM}" test -n "${EMAIL_FROM}"
test -n "${MMONIT}"
sed -re "s/@@EMAIL@@/${EMAIL}/" \ sed -re "s/@@EMAIL@@/${EMAIL}/" \
-e "s/@@EMAIL_FROM@@/${EMAIL_FROM}/" \ -e "s/@@EMAIL_FROM@@/${EMAIL_FROM}/" \
-e "s/@@HOSTNAME@@/${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 -t
monit reload monit reload