public
nobgit
read
NobMail
Based on mailcow: dockerized
Languages
Repository composition by tracked source files.
PHP
49%
JavaScript
35%
HTML
9%
CSS
4%
Shell
2%
Python
1%
Lua
0%
Perl
0%
Ruby
0%
SCSS
0%
Create file
Wiki Documentation
Clone
https://nobgit.com/orgs/nobgit/nobmail.git
ssh://[email protected]:2222/orgs/nobgit/nobmail.git
Commit
check_dns: better time measurement
alpine does not output ms using date, therefore we use perl to get a more accurate measurement of the dns response time. The script output is now even more similar to nagios check_dns.
1c52eaa3
data/Dockerfiles/watchdog/check_dns.sh | 8 ++++----
docker-compose.yml | 2 +-
2 files changed, 5 insertions(+), 5 deletions(-)
Diff
diff --git a/data/Dockerfiles/watchdog/check_dns.sh b/data/Dockerfiles/watchdog/check_dns.sh
index ce4cfa3b..ba430fe9 100755
--- a/data/Dockerfiles/watchdog/check_dns.sh
+++ b/data/Dockerfiles/watchdog/check_dns.sh
@@ -19,19 +19,19 @@ if [ -z "$HOST" ]; then
fi
# run dig and measure the time it takes to run
-START_TIME=$(date +%s%3N)
+START_TIME=$(perl -MTime::HiRes -e 'print Time::HiRes::time')
dig_output=$(dig +short +timeout=2 +tries=1 "$HOST" @"$SERVER" 2>/dev/null)
dig_rc=$?
+END_TIME=$(perl -MTime::HiRes -e 'print Time::HiRes::time')
dig_output_ips=$(echo "$dig_output" | grep -E '^[0-9.]+$' | sort | paste -sd ',' -)
-END_TIME=$(date +%s%3N)
-ELAPSED_TIME=$((END_TIME - START_TIME))
+ELAPSED_TIME=$(perl -e "printf('%.3f', $END_TIME - $START_TIME)")
# validate and perform nagios like output and exit codes
if [ $dig_rc -ne 0 ] || [ -z "$dig_output" ]; then
echo "Domain $HOST was not found by the server"
exit 2
elif [ $dig_rc -eq 0 ]; then
- echo "DNS OK: $ELAPSED_TIME ms response time. $HOST returns $dig_output_ips"
+ echo "DNS OK: $ELAPSED_TIME seconds response time. $HOST returns $dig_output_ips"
exit 0
else
echo "Unknown error"
diff --git a/docker-compose.yml b/docker-compose.yml
index ce33e3d9..4119bea1 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -521,7 +521,7 @@ services:
- /lib/modules:/lib/modules:ro
watchdog-mailcow:
- image: ghcr.io/mailcow/watchdog:2.09
+ image: ghcr.io/mailcow/watchdog:2.10
dns:
- ${IPV4_NETWORK:-172.22.1}.254
tmpfs: