[Watchdog] Send mail when starting

[Compose] Update watchdog and remove oom check for compatibility
master
andryyy 2019-04-18 22:09:26 +02:00
parent 9f00d956f1
commit 5be4885c15
No known key found for this signature in database
GPG Key ID: 8EC34FF2794E25EF
3 changed files with 8 additions and 3 deletions

View File

@ -12,6 +12,7 @@ RUN apk add --update \
coreutils \ coreutils \
jq \ jq \
fcgi \ fcgi \
openssl \
nagios-plugins-mysql \ nagios-plugins-mysql \
nagios-plugins-dns \ nagios-plugins-dns \
nagios-plugins-disk \ nagios-plugins-disk \

View File

@ -58,9 +58,10 @@ function mail_error() {
log_msg "Cannot determine MX for ${rcpt}, skipping email notification..." log_msg "Cannot determine MX for ${rcpt}, skipping email notification..."
return 1 return 1
fi fi
[[ ${1} == "watchdog-mailcow" ]] && SUBJECT="Watchdog started" || SUBJECT="Watchdog: ${1} hit the error rate limit"
[ -f "/tmp/${1}" ] && ATTACH="--attach /tmp/${1}@text/plain" || ATTACH= [ -f "/tmp/${1}" ] && ATTACH="--attach /tmp/${1}@text/plain" || ATTACH=
./smtp-cli --missing-modules-ok \ ./smtp-cli --missing-modules-ok \
--subject="Watchdog: ${1} hit the error rate limit" \ --subject="${SUBJECT}" \
--body-plain="${BODY}" \ --body-plain="${BODY}" \
--to=${rcpt} \ --to=${rcpt} \
--from="watchdog@${MAILCOW_HOSTNAME}" \ --from="watchdog@${MAILCOW_HOSTNAME}" \
@ -447,6 +448,9 @@ Empty
return 1 return 1
} }
# Notify about start
[[ ! -z ${WATCHDOG_NOTIFY_EMAIL} ]] && mail_error "watchdog-mailcow" "Watchdog started monitoring mailcow."
# Create watchdog agents # Create watchdog agents
( (
while true; do while true; do

View File

@ -359,14 +359,14 @@ services:
- /lib/modules:/lib/modules:ro - /lib/modules:/lib/modules:ro
watchdog-mailcow: watchdog-mailcow:
image: mailcow/watchdog:1.40 image: mailcow/watchdog:1.41
# Debug # Debug
#command: /watchdog.sh #command: /watchdog.sh
build: ./data/Dockerfiles/watchdog build: ./data/Dockerfiles/watchdog
oom_kill_disable: true
volumes: volumes:
- rspamd-vol-1:/var/lib/rspamd - rspamd-vol-1:/var/lib/rspamd
- mysql-socket-vol-1:/var/run/mysqld/ - mysql-socket-vol-1:/var/run/mysqld/
- ./data/assets/ssl:/etc/ssl/mail/:ro
restart: always restart: always
environment: environment:
- LOG_LINES=${LOG_LINES:-9999} - LOG_LINES=${LOG_LINES:-9999}