Module: monitoring-plugins Branch: upstream/pr/1431 Commit: d6bfbe33082309459b0d8ce289769f123c8d2451 Author: Christian Kujau <cku...@users.noreply.github.com> Committer: Jan Wagner <w...@cyconet.org> Date: Thu Sep 22 13:34:25 2016 -0700 URL: https://www.monitoring-plugins.org/repositories/monitoring-plugins/commit/?id=d6bfbe3
check_dig: use +retry instead of +tries After upgrading from an Ubuntu/15.10 installation to 16.04, I noticed that check_dig is always returning a WARNING: $ /usr/lib/nagios/plugins/check_dig -l localhost -v /usr/bin/dig -p 53 @127.0.0.1 localhost A +tries=3 +time=6 Looking for: 'localhost' DNS WARNING - 0.008 seconds response time (dig returned an error status)|time=0.008274s;;;0.000000 The older Ubuntu installation got its check_dig from the nagios-plugins-standard package[0] which did not include the +tries option. The current Ubuntu version provides its check_dig from the monitoring-plugins-standard package[1], which _does_ use the +tries option that was introduced with df53473[2]. On my system, it so happens that /usr/bin/dig is provided not by the (BIND) dnsutils package but by knot-dnsutils[3] from the Knot DNS project. The Knot dig(1) command doesn't support the +tries option[4] but does support +retry (which is also supported[5] by the BIND dig(1) command). One way to fix that would be for me to install the BIND dnsutils package. But I did not want to do that: it's so much larger in size and pulls in much more dependencies than the knot-dnsutils package. The patch below changes check_dig to use +retry instead of +tries. Both options are similar, but not the same: +retry - Sets the number of times to retry UDP queries to server to T instead of the default, 2. Unlike +tries, this does not include the initial query As number_tries seems to be hard coded to 3, I've lowered DEFAULT_TRIES to 2 so check_dig should behave as before (with +tries=3). TL;DR: when using +retry instead of +tries, both ISC dig and Knot kdig are working with "check_dig -t". [0] http://packages.ubuntu.com/wily/nagios-plugins-standard [1] http://packages.ubuntu.com/xenial/monitoring-plugins-standard [2] https://github.com/monitoring-plugins/monitoring-plugins/commit/df53473 [3] http://packages.ubuntu.com/xenial/knot-dnsutils [4] https://knot.readthedocs.io/en/latest/man_kdig.html#notes [5] https://ftp.isc.org/isc/bind9/cur/9.10/doc/arm/man.dig.html Note: this has been sent to -devel in May already but only now I managed to create this pull-request. > [PATCH] check_dig: use +retry instead of +tries > https://www.monitoring-plugins.org/archive/devel/2016-May/010312.html Signed-off-by: Christian Kujau <lists at nerdbynature.de> --- plugins/check_dig.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/check_dig.c b/plugins/check_dig.c index da4f0de..e01cf3e 100644 --- a/plugins/check_dig.c +++ b/plugins/check_dig.c @@ -3,7 +3,7 @@ * Monitoring check_dig plugin * * License: GPL -* Copyright (c) 2002-2008 Monitoring Plugins Development Team +* Copyright (c) 2002-2016 Monitoring Plugins Development Team * * Description: * @@ -33,7 +33,7 @@ * because on some architectures those strings are in non-writable memory */ const char *progname = "check_dig"; -const char *copyright = "2002-2008"; +const char *copyright = "2002-2016"; const char *email = "devel@monitoring-plugins.org"; #include "common.h"