centreon / centreon-plugins

Collection of standard plugins to discover and gather cloud-to-edge metrics and status across your whole IT infrastructure.
https://www.centreon.com
Apache License 2.0
310 stars 274 forks source link

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

Closed ritouret closed 2 days ago

ritouret commented 1 year ago

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 ?

garnier-quentin commented 1 year ago

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

ritouret commented 1 year ago

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.

lucie-dubrunfaut commented 2 months ago

Hello :)

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

garnier-quentin commented 2 months ago

@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' 
omercier commented 1 week ago

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
ritouret commented 2 days ago

Thanks to Quentin and Olivier