mirror of
https://github.com/mailcow/mailcow-dockerized.git
synced 2025-12-22 06:11:32 +00:00
watchdog: added postfix-tlspol check (#6691)
This commit is contained in:
@@ -450,6 +450,31 @@ postfix_checks() {
|
|||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
postfix-tlspol_checks() {
|
||||||
|
err_count=0
|
||||||
|
diff_c=0
|
||||||
|
THRESHOLD=${POSTFIX_TLSPOL_THRESHOLD}
|
||||||
|
# Reduce error count by 2 after restarting an unhealthy container
|
||||||
|
trap "[ ${err_count} -gt 1 ] && err_count=$(( ${err_count} - 2 ))" USR1
|
||||||
|
while [ ${err_count} -lt ${THRESHOLD} ]; do
|
||||||
|
touch /tmp/postfix-tlspol-mailcow; echo "$(tail -50 /tmp/postfix-tlspol-mailcow)" > /tmp/postfix-tlspol-mailcow
|
||||||
|
host_ip=$(get_container_ip postfix-tlspol-mailcow)
|
||||||
|
err_c_cur=${err_count}
|
||||||
|
/usr/lib/nagios/plugins/check_tcp -4 -H ${host_ip} -p 8642 2>> /tmp/postfix-tlspol-mailcow 1>&2; err_count=$(( ${err_count} + $? ))
|
||||||
|
[ ${err_c_cur} -eq ${err_count} ] && [ ! $((${err_count} - 1)) -lt 0 ] && err_count=$((${err_count} - 1)) diff_c=1
|
||||||
|
[ ${err_c_cur} -ne ${err_count} ] && diff_c=$(( ${err_c_cur} - ${err_count} ))
|
||||||
|
progress "Postfix TLS Policy companion" ${THRESHOLD} $(( ${THRESHOLD} - ${err_count} )) ${diff_c}
|
||||||
|
if [[ $? == 10 ]]; then
|
||||||
|
diff_c=0
|
||||||
|
sleep 1
|
||||||
|
else
|
||||||
|
diff_c=0
|
||||||
|
sleep $(( ( RANDOM % 60 ) + 20 ))
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
clamd_checks() {
|
clamd_checks() {
|
||||||
err_count=0
|
err_count=0
|
||||||
diff_c=0
|
diff_c=0
|
||||||
@@ -927,6 +952,18 @@ PID=$!
|
|||||||
echo "Spawned mailq_checks with PID ${PID}"
|
echo "Spawned mailq_checks with PID ${PID}"
|
||||||
BACKGROUND_TASKS+=(${PID})
|
BACKGROUND_TASKS+=(${PID})
|
||||||
|
|
||||||
|
(
|
||||||
|
while true; do
|
||||||
|
if ! postfix-tlspol_checks; then
|
||||||
|
log_msg "Postfix TLS Policy hit error limit"
|
||||||
|
echo postfix-tlspol-mailcow > /tmp/com_pipe
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
) &
|
||||||
|
PID=$!
|
||||||
|
echo "Spawned postfix-tlspol_checks with PID ${PID}"
|
||||||
|
BACKGROUND_TASKS+=(${PID})
|
||||||
|
|
||||||
(
|
(
|
||||||
while true; do
|
while true; do
|
||||||
if ! dovecot_checks; then
|
if ! dovecot_checks; then
|
||||||
|
|||||||
@@ -577,6 +577,7 @@ services:
|
|||||||
- MYSQL_REPLICATION_THRESHOLD=${MYSQL_REPLICATION_THRESHOLD:-1}
|
- MYSQL_REPLICATION_THRESHOLD=${MYSQL_REPLICATION_THRESHOLD:-1}
|
||||||
- SOGO_THRESHOLD=${SOGO_THRESHOLD:-3}
|
- SOGO_THRESHOLD=${SOGO_THRESHOLD:-3}
|
||||||
- POSTFIX_THRESHOLD=${POSTFIX_THRESHOLD:-8}
|
- POSTFIX_THRESHOLD=${POSTFIX_THRESHOLD:-8}
|
||||||
|
- POSTFIX_TLSPOL_THRESHOLD=${POSTFIX_TLSPOL_THRESHOLD:-8}
|
||||||
- CLAMD_THRESHOLD=${CLAMD_THRESHOLD:-15}
|
- CLAMD_THRESHOLD=${CLAMD_THRESHOLD:-15}
|
||||||
- DOVECOT_THRESHOLD=${DOVECOT_THRESHOLD:-12}
|
- DOVECOT_THRESHOLD=${DOVECOT_THRESHOLD:-12}
|
||||||
- DOVECOT_REPL_THRESHOLD=${DOVECOT_REPL_THRESHOLD:-20}
|
- DOVECOT_REPL_THRESHOLD=${DOVECOT_REPL_THRESHOLD:-20}
|
||||||
|
|||||||
Reference in New Issue
Block a user