centreon-plugins icon indicating copy to clipboard operation
centreon-plugins copied to clipboard

[apps::protocols::dns::plugin] mode request

Open ritouret opened this issue 2 years ago • 4 comments

Hello,

When the DNS server does not answer, it's always UNKNOWN in Centreon. Even if option "--opt-exit=CRITICAL" or "--change-exit=unknown=critical" is used.

It is CRITICAL when one of these option are set through command line : CRITICAL: DNS query failed: query timed out

but not in Centreon Web Interface : (Process Timeout) and service is UNKNOWN state.

Should you add a --timeout option ?

ritouret avatar Mar 02 '23 09:03 ritouret

I have done a fix. Maybe it could help. If you execute it in command line, how long it takes ?

garnier-quentin avatar Mar 07 '23 13:03 garnier-quentin

Hello Quentin,

Here is the duration :

time /usr/lib/centreon/plugins/centreon-plugins/src/centreon_plugins.pl --plugin=apps::protocols::dns::plugin --mode=request --nameservers=X.X.X.X --search=xxx.xxx.fr -expected-answer=X.X.X.X --warning=5 --critical=7 --change-exit=unknown=critical

CRITICAL: DNS query failed: query timed out

real 2m30.262s user 0m0.108s sys 0m0.023s

The service is still UNKNOWN with your last version in Centreon WEB Interface.

ritouret avatar Mar 09 '23 17:03 ritouret

Hello :)

Can you tell us if you still encounter this issue? I had create an issue ticket in our backlog about this issue.

lucie-tirand avatar Jun 19 '24 10:06 lucie-tirand

@ritouret by default centreon-engine timeouts after 60 seconds. So you need to set following parameters (for example):

--dns-options='udp_timeout=10' --dns-options='tcp_timeout=30' 

garnier-quentin avatar Jun 19 '24 11:06 garnier-quentin

I think 30 seconds is an eternity for a DNS resolution @garnier-quentin ;-) And the retries make it last more than 1 minute in my tests.

This combination makes the execution last only about 5-6 seconds and returns a critical:

centreon-engine@central-deb-24-04:~$ time /usr/lib/centreon/plugins/centreon_protocol_dns.pl --plugin apps::protocols::dns::plugin --mode request --nameservers=1.2.3.4 --search=toto.fr -expected-answer=3.4.5.6 --warning=5 --critical=7 --dns-options='udp_timeout=1' --dns-options='tcp_timeout=1' --dns-options='retry=1'
CRITICAL: DNS query failed: query timed out 

real	0m5.172s
user	0m0.132s
sys	0m0.035s

omercier avatar Aug 13 '24 12:08 omercier

Thanks to Quentin and Olivier

ritouret avatar Aug 20 '24 13:08 ritouret