check_dns: fix on BSD hosts

This commit is contained in:
Cyberes 2024-02-25 18:59:35 -07:00
parent 2e6a0b9bc1
commit 1044d76bf5
1 changed files with 1 additions and 1 deletions

View File

@ -42,7 +42,7 @@ response_time=$((end_time - start_time))
perfdata="response_time=${response_time}ms;${warning_time};${critical_time};0;"
# Check response time against warning and critical levels
if [ -z "$result" ] || echo "$result" | grep -q "no servers could be reached"; then
if [ -z "$result" ] || echo "$result" | grep -Eq "(no servers could be reached|communications error)"; then
echo "CRITICAL - DNS resolution failed for $query_domain on $dns_server | $perfdata"
exit 2
elif [ "$critical_time" -gt 0 ] && [ "$response_time" -gt "$critical_time" ]; then