Check dns improve queries#405
Open
inqrphl wants to merge 12 commits into
Open
Conversation
added 5 commits
July 10, 2026 15:28
add the ability to specify /etc/resolv.conf add the ability to append search domains to hostname todo: implement dns queries over multiple nameservers, currently it only uses the first one in config implement dns queries over multiple search domains, currently it only uses the first one in config implement warning critical timeouts
…rough context object
previously the code would parse a resolv.conf and pick the first option, not trying to combine all possible names and search paths. the code now checks multiple combinations, until it gets an non-empty answer add a custom argument ResolvConfFile to point at a different resolv.conf add logging support, takes the logger passed through context. use it to print logs if verbose mode is enabled rework handling comparions required to check for expected strings from argumnets. use slice comparion functions
fix typo in platform check "darwin" properly exit the DNS query loop after getting an answer suppress linter from complaining about reutned context regenerate docs
warning and critical thresholds on the total time for the DNS queries, until a successfull non-empty answer is found. the program still returns the query results , but raises a warning/critical status as well warning/critical thresholds use the total time needed, just like montioring-plugins check_dns, which launches nslookup executable. this program does the dns queries itself, multiples of them if multiple nameservers and search domains are configured added also timeout, which stops the program and returns critical directly when exceeded. default is 10 seconds.
…one.one address test expected string functionality , MX and AAAA records
Contributor
Author
|
todo: add time metric , get it from the valid and useful dns query. so far we have been ignoring it |
Contributor
Author
|
./snclient -vvv --logfile stdout run check_dns --host labs.consol.de ./snclient -vvv --logfile stdout run check_dns --host thishostdoesnotexist.com |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
add support for performing multiple queries over given nameservers and search domains in resolv.conf file. previosuly, only the first nameserver was used, and search domains were not used at all
now check all combinations in the order specified by DNS standard similar to how system libraries resolve them. the combinations are tried until a non-empty answer is found
additionally, add helper functions to snclient codebase to insert logger to the context. this context is passed to builtin_checks: check_dns, check_http , check_nsc_web , check_ssh , check_tcp
added warning, critical thresholds. these work on total time needed to get a valid DNS response, which might need multiple DNS requests over different nameserver + search domain combinations. the program prints out the result, but raises the return status to warning/critical. it does not use the response time of the valid DNS query, but the total time required. this is analog to monitoring-plugins check_dns , which measures the time needed for nslookup and uses it
added timeout argument, this stops the DNS queries completely and returns critical status with the timeout message.