[Watchdog] Minor changes and PID logging for workers, disabling olefy check

master
andryyy 2019-08-03 14:29:02 +02:00
parent cf6ed6b2b4
commit 5f9644e8bd
No known key found for this signature in database
GPG Key ID: 8EC34FF2794E25EF
2 changed files with 62 additions and 24 deletions

View File

@ -526,9 +526,19 @@ olefy_checks() {
} }
# Notify about start # Notify about start
[[ ! -z ${WATCHDOG_NOTIFY_EMAIL} ]] && mail_error "watchdog-mailcow" "Watchdog started monitoring mailcow." if [[ ! -z ${WATCHDOG_NOTIFY_EMAIL} ]] && [[ ! -f /tmp/watchdog_reload ]]; then
mail_error "watchdog-mailcow" "Watchdog started monitoring mailcow."
rm /tmp/watchdog_reload
fi
# Create watchdog agents # Create watchdog agents
(
touch /tmp/watchdog_reload
sleep 60
echo "Reloading watchdog"
kill 1
) &
( (
while true; do while true; do
if ! nginx_checks; then if ! nginx_checks; then
@ -537,7 +547,9 @@ while true; do
fi fi
done done
) & ) &
BACKGROUND_TASKS+=($!) PID=$!
echo "Spawned nginx_checks with PID ${PID}"
BACKGROUND_TASKS+=(${PID})
( (
while true; do while true; do
@ -547,7 +559,9 @@ while true; do
fi fi
done done
) & ) &
BACKGROUND_TASKS+=($!) PID=$!
echo "Spawned mysql_checks with PID ${PID}"
BACKGROUND_TASKS+=(${PID})
( (
while true; do while true; do
@ -557,7 +571,9 @@ while true; do
fi fi
done done
) & ) &
BACKGROUND_TASKS+=($!) PID=$!
echo "Spawned phpfpm_checks with PID ${PID}"
BACKGROUND_TASKS+=(${PID})
( (
while true; do while true; do
@ -567,7 +583,9 @@ while true; do
fi fi
done done
) & ) &
BACKGROUND_TASKS+=($!) PID=$!
echo "Spawned sogo_checks with PID ${PID}"
BACKGROUND_TASKS+=(${PID})
if [ ${CHECK_UNBOUND} -eq 1 ]; then if [ ${CHECK_UNBOUND} -eq 1 ]; then
( (
@ -578,7 +596,9 @@ while true; do
fi fi
done done
) & ) &
BACKGROUND_TASKS+=($!) PID=$!
echo "Spawned unbound_checks with PID ${PID}"
BACKGROUND_TASKS+=(${PID})
fi fi
if [[ "${SKIP_CLAMD}" =~ ^([nN][oO]|[nN])+$ ]]; then if [[ "${SKIP_CLAMD}" =~ ^([nN][oO]|[nN])+$ ]]; then
@ -590,7 +610,9 @@ while true; do
fi fi
done done
) & ) &
BACKGROUND_TASKS+=($!) PID=$!
echo "Spawned clamd_checks with PID ${PID}"
BACKGROUND_TASKS+=(${PID})
fi fi
( (
@ -601,7 +623,9 @@ while true; do
fi fi
done done
) & ) &
BACKGROUND_TASKS+=($!) PID=$!
echo "Spawned postfix_checks with PID ${PID}"
BACKGROUND_TASKS+=(${PID})
( (
while true; do while true; do
@ -611,7 +635,9 @@ while true; do
fi fi
done done
) & ) &
BACKGROUND_TASKS+=($!) PID=$!
echo "Spawned dovecot_checks with PID ${PID}"
BACKGROUND_TASKS+=(${PID})
( (
while true; do while true; do
@ -621,7 +647,9 @@ while true; do
fi fi
done done
) & ) &
BACKGROUND_TASKS+=($!) PID=$!
echo "Spawned rspamd_checks with PID ${PID}"
BACKGROUND_TASKS+=(${PID})
( (
while true; do while true; do
@ -631,7 +659,9 @@ while true; do
fi fi
done done
) & ) &
BACKGROUND_TASKS+=($!) PID=$!
echo "Spawned ratelimit_checks with PID ${PID}"
BACKGROUND_TASKS+=(${PID})
( (
while true; do while true; do
@ -641,17 +671,21 @@ while true; do
fi fi
done done
) & ) &
BACKGROUND_TASKS+=($!) PID=$!
echo "Spawned fail2ban_checks with PID ${PID}"
BACKGROUND_TASKS+=(${PID})
( #(
while true; do #while true; do
if ! olefy_checks; then # if ! olefy_checks; then
log_msg "Olefy hit error limit" # log_msg "Olefy hit error limit"
echo olefy-mailcow > /tmp/com_pipe # echo olefy-mailcow > /tmp/com_pipe
fi # fi
done #done
) & #) &
BACKGROUND_TASKS+=($!) #PID=$!
#echo "Spawned olefy_checks with PID ${PID}"
#BACKGROUND_TASKS+=(${PID})
( (
while true; do while true; do
@ -661,7 +695,9 @@ while true; do
fi fi
done done
) & ) &
BACKGROUND_TASKS+=($!) PID=$!
echo "Spawned acme_checks with PID ${PID}"
BACKGROUND_TASKS+=(${PID})
( (
while true; do while true; do
@ -671,7 +707,9 @@ while true; do
fi fi
done done
) & ) &
BACKGROUND_TASKS+=($!) PID=$!
echo "Spawned ipv6nat_checks with PID ${PID}"
BACKGROUND_TASKS+=(${PID})
# Monitor watchdog agents, stop script when agents fails and wait for respawn by Docker (restart:always:n) # Monitor watchdog agents, stop script when agents fails and wait for respawn by Docker (restart:always:n)
( (

View File

@ -365,7 +365,7 @@ services:
- /lib/modules:/lib/modules:ro - /lib/modules:/lib/modules:ro
watchdog-mailcow: watchdog-mailcow:
image: mailcow/watchdog:1.51 image: mailcow/watchdog:1.52
# Debug # Debug
#command: /watchdog.sh #command: /watchdog.sh
build: ./data/Dockerfiles/watchdog build: ./data/Dockerfiles/watchdog