This was just brought to my attention today, and applies to both
check_dns. The plugins’ output and perf data reflect the execution time of the plugin, rather than the time it took to get a response from the DNS server. Is this something that can be changed with
Here’s what I’m seeing:
$ time /usr/lib/nagios/plugins/check_dig -l .... -t 10 DNS OK - 0.015 seconds response time (...)|time=0.014952s;;;0.000000 real 0m0.018s
According to the plugin, it took about 15ms to receive a response from the server. Technically this is true, if you count the time to actually run the plugin. Compare to:
$ time dig ... ; <<>> DiG 9.10.3-P4-Debian <<>> ... ;; global options: +cmd ;; Got answer: ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 36655 ;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1 ;; OPT PSEUDOSECTION: ; EDNS: version: 0, flags:; udp: 512 ;; QUESTION SECTION: ;... IN A ;; ANSWER SECTION: ... 0 IN A ... ;; Query time: 0 msec real 0m0.015s
If I just run
dig, it still takes about 15ms to run, but I can see that the time to get a response from the server was less than 1ms. Works out the same with check_dns and nslookup, also.