diff --git a/check_dns.sh b/check_dns.sh index 848c543..fcf2fa6 100755 --- a/check_dns.sh +++ b/check_dns.sh @@ -27,7 +27,7 @@ if [[ -z $query_domain && ${query_domain+x} ]]; then fi # Perform DNS resolution check and measure the time -start_time=$(date +%s%N) +start_time=$(date +%s) if [[ -z "$dns_server" ]]; then # The DNS server was not provided. @@ -37,8 +37,8 @@ else result=$(dig @$dns_server "$query_domain" +short) fi -end_time=$(date +%s%N) -response_time=$(((end_time - start_time) / 1000000)) +end_time=$(date +%s) +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 diff --git a/packages.txt b/packages.txt index ede148e..4ec3f62 100644 --- a/packages.txt +++ b/packages.txt @@ -6,4 +6,4 @@ smartmontools curl recode python3-pip -dig +dnsutils