summaryrefslogtreecommitdiffstats
path: root/plugins/check_dig.c
AgeCommit message (Collapse)AuthorFilesLines
2016-11-08check_dig: use +retry instead of +triesrefs/pull/1442/headChristian Kujau1-2/+2
After upgrading from an Ubuntu/15.10 to 16.04 installation, 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). Thanks, Christian. [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://www.knot-dns.cz/docs/2.x/html/man_kdig.html#notes [5] https://ftp.isc.org/isc/bind9/cur/9.10/doc/arm/man.dig.html Signed-off-by: Christian Kujau <lists@nerdbynature.de>
2015-10-15check_dig: expected answer is now incasesensitiverefs/pull/1386/headDaniel Stirnimann1-1/+1
check_dig was casesensitive if an expected answer is given. Switching strstr with strcasestr fixes this issue While testing i noticed a bug where expected is not an exact match New issue for that is opened #1385 This fix closes #1233
2015-10-04use unknown exit code for help/version in pluginsSven Nierlein1-2/+2
Signed-off-by: Sven Nierlein <sven@nierlein.de>
2014-07-30check_dig: takes into account the -4 and -6 switchAlexander Wittig1-1/+4
Fix automatic DNS server name detection to honor -4 and -6 switches (default to 127.0.0.1 or ::1 respectively, i.e. if -6 is given ::1 is used instead of 127.0.0.1)
2014-07-30check_dig: Fix to work with dig and drill toolAlexander Wittig1-2/+2
FreeBSD starting with version 10 is shipped with ldns instead of bind as resolver. Consequently the dig tool in base is replaced by drill. While dig can still be installed as a third party application, it would be nice to make do with the tools available in the system already. This patch rearranges the command line used to invoke dig slightly so that it can be used with both dig and drill (tested with dig 9.8.3-P1 and 9.9.4 as well as drill 1.6.16). It would be really neat if the configure script could be changed to automatically pick up drill when dig is not available (or the other way around), but my autotools-foo is not good enough for that. This part of the patch is an extended version of the locally maintained patch currently deployed in the FreeBSD ports tree by Dmitry Sivachenko.
2014-01-30check_dig: Declare variable at the topHolger Weiss1-1/+2
C89 doesn't allow variable declarations to be intermingled with code.
2014-01-30check_dig: stick with integer devisionJan Wagner1-1/+1
This change saves us from having to link check_dig against "libm"
2014-01-30check_dig: timeout_interval is a global variableJan Wagner1-2/+0
which is already set to 10 seconds
2014-01-30check_dig: patch to make dig honor -t optionJan Wagner1-2/+9
When a timeout value is specified with the -t option, dig will sometimes timeout before the timer is actually reached. The problem occurs because the check_dig plugin does not pass the specified timeout value to dig, leaving dig to timeout with it's default value which seems to be around 10-15seconds. To reproduce: time ./check_dig -H 127.0.0.2 -l www.google.com -t 30 It will not run for 30secs, which is the expected behaviour. The following will work, because the timeout is less than the default dig timeout, so the plugin cancels the dig command: time ./check_dig -H 127.0.0.2 -l www.google.com -t 2 This fix passes the timeout value to dig, and sets the number of retries which tends to vary from system to system by default. Closes #1168
2014-01-28check_dig: fix wrong IPv6 arguments orderThomas Guyot-Sionnest1-2/+2
2014-01-21Merge branch 'rename'Thomas Guyot-Sionnest1-3/+3
2014-01-21plugins/*.c: Alterations for timeout messages.Spenser Reinhardt1-1/+1
.c file changes for misleading timeout messages in help functions. Solution to pull request #1209 tracker by awiddersheim. Files: plugins/check_apt.c, plugins/check_by_ssh.c, plugins/check_dbi.c, plugins/check_dig.c, plugins/check_disk.c, plugins/check_dns.c, plugins/check_game.c, plugins/check_http.c, plugins/check_ldap.c, plugins/check_ntp.c, plugins/check_ntp_peer.c, plugins/check_ntp_time.c, plugins/check_nwstat.c, plugins/check_overcr.c, plugins/check_pgsql.c, plugins/check_ping.c, plugins/check_procs.c, plugins/check_radius.c, plugins/check_real.c, plugins/check_smtp.c, plugins/check_snmp.c, plugins/check_ssh.c, plugins/check_tcp.c, plugins/check_time.c, plugins/check_ups.c, plugins/negate.c
2014-01-20Capitalize "Monitoring" when it's the first wordHolger Weiss1-1/+1
2014-01-19Project rename initial commit.Monitoring Plugins Development Team1-3/+3
This is an initial take at renaming the project to Monitoring Plugins. It's not expected to be fully complete, and it is expected to break things (The perl module for instance). More testing will be required before this goes mainline.
2013-05-12plugins: rename runcmd's signal handler.Diego Elio Pettenò1-1/+1
The previous name would collide with popen's. Even if the two are never used together, it's still a good idea not to have the same symbol in multiple object files.
2013-01-23check_dig: query transport selection supportVille Mattila1-3/+16
Add command line options -4 and -6 (--use-ipv4 and --use-ipv6) to check_dig. Effectively this adds no new functionality, just a shortcut for: check_dig -A "-4" check_dig -A "-6" Needed for using check_dig with the check_v46 wrapper (see e.g. https://gitorious.org/nagios-monitoring-tools/nagios-monitoring-tools/blobs/master/check_v46) which requires -4/-6 command line option support.
2012-06-29Die when asprintf failsAnders Kaseorg1-2/+2
Fixes many instances of warning: ignoring return value of 'asprintf', declared with attribute warn_unused_result [-Wunused-result] Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2010-04-22Add newline after "Usage:" in --helpThomas Guyot-Sionnest1-1/+1
2010-04-22Standardize the extra-opts notesThomas Guyot-Sionnest1-6/+0
2010-04-14Fix translations when extra-opts aren't enabledThomas Guyot-Sionnest1-8/+8
Bug #2832884 reported problem with translations outputting pot file headers. This is caused by "" matching the header of the translation files. This patch moves gettext macros inside utils macros and update some french translations.
2008-11-23Removing CVS/SVN tags and replacing with git-based versioningThomas Guyot-Sionnest1-6/+2
For contrib/, full tags have been imported from subversion git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@2091 f882894a-f735-0410-b71e-b25c423dba1c
2008-06-09Added testcases for check_digMatthias Eble1-3/+8
check_dig's -l option is mandatory now (#1986306) git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@2011 f882894a-f735-0410-b71e-b25c423dba1c
2008-05-07Added support for --extra-opts in all C plugins (disabled by default, see ↵Thomas Guyot-Sionnest1-1/+12
configure --help) git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1991 f882894a-f735-0410-b71e-b25c423dba1c
2008-04-27--help output cleanup (plus removal of spaces on blank lines)Thomas Guyot-Sionnest1-2/+5
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1984 f882894a-f735-0410-b71e-b25c423dba1c
2008-03-20- Fix bug #1920671Thomas Guyot-Sionnest1-8/+9
- Make --help output looks nice git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1959 f882894a-f735-0410-b71e-b25c423dba1c
2008-03-14Added -A/--dig-arguments to check_dig (#1889453/#1874041)Matthias Eble1-3/+13
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1943 f882894a-f735-0410-b71e-b25c423dba1c
2008-01-30Bump plugins/ to GPLv3 (check_apt to check_nwstat)Thomas Guyot-Sionnest1-18/+16
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1916 f882894a-f735-0410-b71e-b25c423dba1c
2007-01-28Don't try to print `optarg' (which will be a NULL pointer) if an unknownHolger Weiss1-2/+2
command line option was used, as this leads to a segfault on some systems. The unknown option will be printed by getopt(3) anyway. So, simply call print_usage() and exit UNKNOWN via the new usage5() instead. git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1590 f882894a-f735-0410-b71e-b25c423dba1c
2006-10-19first pass at cleaning localization for new releaseBenoit Mortier1-18/+31
first pass at making all the headre be the same licence, plugin, etc... git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1499 f882894a-f735-0410-b71e-b25c423dba1c
2006-07-03Fixed -p getopt call (Allan Bennett - 1511650)Ton Voon1-2/+3
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1439 f882894a-f735-0410-b71e-b25c423dba1c
2006-06-14starting the BIG locale update ;-)Benoit Mortier1-29/+8
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1425 f882894a-f735-0410-b71e-b25c423dba1c
2005-11-14start of the cleaning of the localizationBenoit Mortier1-234/+247
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1282 f882894a-f735-0410-b71e-b25c423dba1c
2005-10-24initial merging of ae's np_runcmd code into selected plugins.M. Sean Finney1-99/+69
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1260 f882894a-f735-0410-b71e-b25c423dba1c
2005-01-26Convert tabs to spaces from dig's answer section (Randy O'Meara - 1107651)Ton Voon1-1/+7
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1108 f882894a-f735-0410-b71e-b25c423dba1c
2004-12-25various fixes for localizationBenoit Mortier1-5/+3
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1061 f882894a-f735-0410-b71e-b25c423dba1c
2004-12-04internationalization fixesBenoit Mortier1-2/+2
bugfixes git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1001 f882894a-f735-0410-b71e-b25c423dba1c
2004-12-03reverting my changes from !=TRUE to == ERROR, that's not good ;-( sorryBenoit Mortier1-1/+1
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@998 f882894a-f735-0410-b71e-b25c423dba1c
2004-12-03print_help and print_usage() cleanupBenoit Mortier1-3/+3
other misc cleanups git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@996 f882894a-f735-0410-b71e-b25c423dba1c
2004-12-03remove UT_HLP_VRS from print_usageBenoit Mortier1-2/+0
this was not a good idea ;-) git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@994 f882894a-f735-0410-b71e-b25c423dba1c
2004-12-03internationalization fixes and help fixesBenoit Mortier1-5/+4
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@989 f882894a-f735-0410-b71e-b25c423dba1c
2004-12-03Localization fixesBenoit Mortier1-1/+1
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@988 f882894a-f735-0410-b71e-b25c423dba1c
2004-12-03bump copyright yearBenoit Mortier1-5/+5
initialize result to STATE_UNKNOW in place of STATE_OK git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@982 f882894a-f735-0410-b71e-b25c423dba1c
2004-12-02More internationalization workBenoit Mortier1-2/+2
new usage4 function to permit localisation of think like check_ssh: xxxxx git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@979 f882894a-f735-0410-b71e-b25c423dba1c
2004-12-02return of process_arguments() is TRUE not OK !Benoit Mortier1-1/+1
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@978 f882894a-f735-0410-b71e-b25c423dba1c
2004-12-01standardize localization stringBenoit Mortier1-13/+8
standardize unknow arguments git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@969 f882894a-f735-0410-b71e-b25c423dba1c
2004-12-01first pass at standardization of messages for the localizationBenoit Mortier1-9/+7
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@962 f882894a-f735-0410-b71e-b25c423dba1c
2004-11-24Making messages more consistentTon Voon1-2/+2
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@930 f882894a-f735-0410-b71e-b25c423dba1c
2004-08-18Checks different record types and checks against an expected address (Bill ↵Ton Voon1-21/+58
Kunkel) git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@888 f882894a-f735-0410-b71e-b25c423dba1c
2004-03-04use float for time in perf dataKarl DeBisschop1-3/+3
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@842 f882894a-f735-0410-b71e-b25c423dba1c
2003-11-12remove overflow checks of strtod - HUGE_VALF requires C99; also remove ↵Karl DeBisschop1-8/+4
equality checks on warn/crit interval which are no doubles git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@764 f882894a-f735-0410-b71e-b25c423dba1c