Commit graph

74 commits

Author SHA1 Message Date
Karol Babioch
e0b8ebaa77 plugins: check_dig: Fix spelling 2017-04-21 01:38:39 +02:00
Christian Kujau
4195dc23d1 check_dig: use +retry instead of +tries
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>
2016-11-08 09:54:46 +01:00
Daniel Stirnimann
24eea9fa34 check_dig: expected answer is now incasesensitive
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-15 10:59:32 +02:00
Sven Nierlein
edca257e20 use unknown exit code for help/version in plugins
Signed-off-by: Sven Nierlein <sven@nierlein.de>
2015-10-04 19:24:30 +02:00
Alexander Wittig
8d50765653 check_dig: takes into account the -4 and -6 switch
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-30 15:25:20 +02:00
Alexander Wittig
8c623b1a43 check_dig: Fix to work with dig and drill tool
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-07-30 15:22:33 +02:00
Holger Weiss
4a2a725465 check_dig: Declare variable at the top
C89 doesn't allow variable declarations to be intermingled with code.
2014-01-30 19:51:46 +01:00
Jan Wagner
e33ecc84c7 check_dig: stick with integer devision
This change saves us from having to link check_dig against "libm"
2014-01-30 11:28:19 +01:00
Jan Wagner
2aa6ce2844 check_dig: timeout_interval is a global variable
which is already set to 10 seconds
2014-01-30 11:28:09 +01:00
Jan Wagner
df53473d03 check_dig: patch to make dig honor -t option
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-30 11:07:22 +01:00
Thomas Guyot-Sionnest
58e57b32bf check_dig: fix wrong IPv6 arguments order 2014-01-27 22:16:35 -05:00
Thomas Guyot-Sionnest
11cf54ca78 Merge branch 'rename' 2014-01-21 07:59:07 -05:00
Spenser Reinhardt
212575b858 plugins/*.c: Alterations for timeout messages.
.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-21 11:33:45 +01:00
Holger Weiss
c3e756a855 Capitalize "Monitoring" when it's the first word 2014-01-20 03:12:50 +01:00
Monitoring Plugins Development Team
63734f52ab Project rename initial commit.
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.
2014-01-19 14:18:47 -05:00
Diego Elio Petten
332c6ef2c7 plugins: rename runcmd's signal handler.
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-05-12 14:15:13 +02:00
Ville Mattila
261ad18670 check_dig: query transport selection support
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.
2013-01-23 20:04:04 +01:00
Anders Kaseorg
028d50d6f9 Die when asprintf fails
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>
2012-06-29 13:39:11 +02:00
Thomas Guyot-Sionnest
eaf3cb27f4 Add newline after "Usage:" in --help 2010-04-22 08:57:14 -04:00
Thomas Guyot-Sionnest
884aee0667 Standardize the extra-opts notes 2010-04-21 23:29:18 -04:00
Thomas Guyot-Sionnest
25d1ee331d Fix translations when extra-opts aren't enabled
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.
2010-04-14 08:33:06 -04:00
Thomas Guyot-Sionnest
6fbd14fea5 Removing CVS/SVN tags and replacing with git-based versioning
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-11-23 05:38:47 +00:00
Matthias Eble
d8577e1994 Added testcases for check_dig
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-06-09 19:47:36 +00:00
Thomas Guyot-Sionnest
44f8455b2c Added support for --extra-opts in all C plugins (disabled by default, see configure --help)
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1991 f882894a-f735-0410-b71e-b25c423dba1c
2008-05-07 10:02:42 +00:00
Thomas Guyot-Sionnest
ed62784a0b --help output cleanup (plus removal of spaces on blank lines)
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1984 f882894a-f735-0410-b71e-b25c423dba1c
2008-04-27 14:35:26 +00:00
Thomas Guyot-Sionnest
3419b16cc8 - Fix bug #1920671
- 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-20 11:53:29 +00:00
Matthias Eble
3d4ca92a6b Added -A/--dig-arguments to check_dig (#1889453/#1874041)
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1943 f882894a-f735-0410-b71e-b25c423dba1c
2008-03-14 23:47:41 +00:00
Thomas Guyot-Sionnest
fa4efcdf6d Bump plugins/ to GPLv3 (check_apt to check_nwstat)
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1916 f882894a-f735-0410-b71e-b25c423dba1c
2008-01-30 10:53:47 +00:00
Holger Weiss
fd329a1e91 Don't try to print `optarg' (which will be a NULL pointer) if an unknown
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
2007-01-28 21:46:41 +00:00
Benoit Mortier
082cfc29e3 first pass at cleaning localization for new release
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-10-19 00:25:16 +00:00
Ton Voon
46894f211e Fixed -p getopt call (Allan Bennett - 1511650)
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1439 f882894a-f735-0410-b71e-b25c423dba1c
2006-07-03 08:03:37 +00:00
Benoit Mortier
704aa165c1 starting the BIG locale update ;-)
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1425 f882894a-f735-0410-b71e-b25c423dba1c
2006-06-14 18:48:59 +00:00
Benoit Mortier
c68d99cee2 start of the cleaning of the localization
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1282 f882894a-f735-0410-b71e-b25c423dba1c
2005-11-14 00:51:44 +00:00
M. Sean Finney
ceebd58040 initial merging of ae's np_runcmd code into selected plugins.
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1260 f882894a-f735-0410-b71e-b25c423dba1c
2005-10-24 11:10:29 +00:00
Ton Voon
c9ce6037b5 Convert tabs to spaces from dig's answer section (Randy O'Meara - 1107651)
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1108 f882894a-f735-0410-b71e-b25c423dba1c
2005-01-26 21:21:01 +00:00
Benoit Mortier
e9ccc6b21a various fixes for localization
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1061 f882894a-f735-0410-b71e-b25c423dba1c
2004-12-25 23:17:46 +00:00
Benoit Mortier
81bee45f6e internationalization fixes
bugfixes


git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1001 f882894a-f735-0410-b71e-b25c423dba1c
2004-12-04 12:12:30 +00:00
Benoit Mortier
30a4266a3a reverting my changes from !=TRUE to == ERROR, that's not good ;-( sorry
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@998 f882894a-f735-0410-b71e-b25c423dba1c
2004-12-03 23:55:29 +00:00
Benoit Mortier
5e3fc41c61 print_help and print_usage() cleanup
other misc cleanups


git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@996 f882894a-f735-0410-b71e-b25c423dba1c
2004-12-03 23:02:04 +00:00
Benoit Mortier
edf60f6dce remove UT_HLP_VRS from print_usage
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-03 20:28:53 +00:00
Benoit Mortier
fa002886e3 internationalization fixes and help fixes
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@989 f882894a-f735-0410-b71e-b25c423dba1c
2004-12-03 11:45:10 +00:00
Benoit Mortier
83df67099d Localization fixes
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@988 f882894a-f735-0410-b71e-b25c423dba1c
2004-12-03 09:19:18 +00:00
Benoit Mortier
016d33230e bump copyright year
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-03 00:55:28 +00:00
Benoit Mortier
234481163f More internationalization work
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-02 16:51:25 +00:00
Benoit Mortier
df1bd0c89f return of process_arguments() is TRUE not OK !
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@978 f882894a-f735-0410-b71e-b25c423dba1c
2004-12-02 14:54:36 +00:00
Benoit Mortier
d19edd4043 standardize localization string
standardize unknow arguments


git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@969 f882894a-f735-0410-b71e-b25c423dba1c
2004-12-01 23:54:51 +00:00
Benoit Mortier
54c21eba62 first pass at standardization of messages for the localization
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@962 f882894a-f735-0410-b71e-b25c423dba1c
2004-12-01 19:33:45 +00:00
Ton Voon
0c1c9f51e2 Making messages more consistent
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@930 f882894a-f735-0410-b71e-b25c423dba1c
2004-11-24 00:46:40 +00:00
Ton Voon
5566987984 Checks different record types and checks against an expected address (Bill Kunkel)
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@888 f882894a-f735-0410-b71e-b25c423dba1c
2004-08-18 21:25:50 +00:00
Karl DeBisschop
2563edba02 use float for time in perf data
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@842 f882894a-f735-0410-b71e-b25c423dba1c
2004-03-04 05:08:43 +00:00