Commit graph

1232 commits

Author SHA1 Message Date
Sven Nierlein
596af9df57 updated check dig tests
nagios.com seems to have changed their ip address. Also added tests
about -4/-6 option.
2013-01-23 20:26:41 +01: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
Robin Sonefors
77eba26361 check_snmp: Don't thrash memory when using multiple label/unit argument
The memory allocation mixed up number of bytes with number of pointers,
meaning as soon as we'd reach (on 64 bit systems) the second argument,
we'd start writing it outside of our allocated memory.

Normally, this isn't too visible, but as soon as you (again, on my 64
bit system) reach argument number 8, you get a segfault. It is easily
reproducible with:
check_snmp -o '' -l '' -o '' -l '' -o '' -l '' -o '' -l '' \
           -o '' -l '' -o '' -l '' -o '' -l '' -o '' -l ''

This patch allocates the proper amount of memory, to fix the issue.

Signed-off-by: Robin Sonefors <robin.sonefors@op5.com>
2013-01-23 19:52:24 +01:00
Sven Nierlein
6fde27e478 check_ntp(_time): don't die on connect errors
connect errors may happen if clients check agains dual
stacked ipv4/6 ntp servers.
2012-11-28 13:51:16 +01:00
Sven Nierlein
24772e755e unified ipv4/6 usage and help text 2012-11-28 11:03:11 +01:00
Holger Weiss
92b937e49e check_procs: Remove superfluous newline character 2012-11-14 20:53:47 +01:00
Sebastian Harl
e683a8dce5 check_procs: Added performance data to plugin output. 2012-11-14 20:45:44 +01:00
Sebastian Harl
2bac48c027 check_procs: Use the range/threshold support functions from libnagiosplug.
This adds support for @<range> and makes stuff a bit simpler by removing code
duplications.

Note: Previously, the compatibility code for 'check_procs <warn> <max>'
accepted something like 'check_procs -w 10:-1 -c 10:-1 20 50' as well
(treating it as if '-w 10:20 -c 10:50' was specified). This is no longer the
case ... additional arguments are only used as warn/crit thresholds in case
-w/-c is not specified at all.
2012-11-14 20:45:44 +01:00
Andreas Ericsson
c537d71a3a plugins/check_snmp: Show snmp error when we fail to parse its output
Dying without a hint of what went wrong is just plain annoying. With
this patch we at least get a hint.

While at it, we fix the string offset so the output we're interested
in doesn't keep the equal sign that snmpget prints.

Signed-off-by: Andreas Ericsson <ae@op5.se>
2012-11-02 22:25:37 -04:00
Andreas Ericsson
bd78299056 Make check_snmp backwards compatible in how it parses thresholds
Once upon a time, check_snmp used to accept inverse ranges in the
format of '2:1' to mean "alert if value is inside this range".

Since commit 7cb3ae0933, ranges such
as those have instead triggered the error "Range format incorrect"
and resulted in an UNKNOWN warning state. This patch attempts to
fix the situation so that the old-style ranges continues to mean
exactly what the once did and people with lots of snmp checks can
avoid a bazillion false positives from their environments.

Signed-off-by: Andreas Ericsson <ae@op5.se>
2012-11-02 22:25:37 -04:00
Holger Weiss
b74543a612 Allow for configuring OpenSSL
Let OpenSSL load its configuration file.  See the OPENSSL_config(3) man
page for details.

(Suggested by Max Kosmach in Debian bug report #689960, forwarded by Jan
Wagner.)
2012-10-09 09:44:48 +02:00
Gianluca Varisco
2672e95bca Update plugins/check_disk.c
CRITCAL -> CRITICAL typo
2012-09-25 17:45:12 +03:00
Holger Weiss
4cdda35b6c check_http: Update description of -C option
Mention that the -C option now accepts two comma-separated values.
2012-08-10 13:07:44 +02:00
Holger Weiss
d3c9728ebf check_http: Add missing newline to --help output 2012-08-10 13:05:31 +02:00
William Leibzon
6b844aea9f fixing bug in certificate experiation patch checking for bad warning threshold data 2012-08-10 13:03:00 +02:00
Holger Weiss
66003414af tests/check_http.t: Fix whitespace issues
In tests/check_http.t, tabs are used for indentation.

While at it, apply another few cosmetic changes.
2012-08-10 12:49:30 +02:00
Holger Weiss
3f944a50b7 tests/check_http.t: Update the number of SSL tests 2012-08-10 12:41:41 +02:00
Holger Weiss
62d01df1fd tests/check_http.t: Fix test case
Fix the test case which is meant to make sure that

	check_http -C <n>,<m> [...]

returns a CRITICAL state if <m> is large enough.
2012-08-10 12:35:16 +02:00
Holger Weiss
cc04d9f188 check_ntp_peer: Fix --help output for -m and -n
Fix the threshold specifications in the example for checking the number
of truechimers.

Reported by Marc Haber on the "nagios-users" mailing list (Message-ID:
<20120722142840.GA6931@torres.zugschlus.de>).
2012-08-06 21:03:06 +02:00
Holger Weiss
48b83c45af check_ntp_peer: Fix --help output for -W and -C
Mention that the check_ntp_peer plugin checks the stratum of the
synchronization peer, not the stratum of the monitored server itself.

Thanks to Marc Haber for bringing this up on the "nagios-users" mailing
list (Message-ID: <20120722142840.GA6931@torres.zugschlus.de>).
2012-08-06 20:37:43 +02:00
Holger Weiss
3c10d84ea2 check_http: Fix whitespace issues
In check_http.c, tabs aren't used for indentation.
2012-07-18 23:39:05 +02:00
Holger Weiss
ea595f1371 check_http: Fix compilation without SSL support
The "ssl_version" variable was undeclared when the plugins were compiled
--without-openssl and --without-gnutls.

Bug reported by Michael LaCorte on the "nagiosplug-help" mailing list
(Message-ID: <CCD30C91-A2A8-463A-82A9-F99B54F741D3@gmail.com>).
2012-07-18 23:31:17 +02:00
Holger Weiss
800a868713 Merge remote-tracking branch 'github/tokkee/sh/check_dbi' 2012-07-04 23:50:48 +02:00
Eric Stanley
49df5964eb Re-added missing variable declarations to check_smtp.c
A recent update removed the declarations for a couple variables in
check_smtp.c that are still being used, which caused a failure
in the compilation of check_smtp.c. This commit restores those variable
declarations so the check_smtp.c will again compile.
2012-07-04 12:48:07 -05:00
Holger Weiss
b57aeb1e5f check_smtp: Remove a comment regarding MAIL FROM
Earlier versions of check_smtp generated an (invalid) "MAIL FROM"
command without arguments by default.  These days, a "MAIL FROM" command
is only sent if the --from option is specified.

This commit removes a comment which explains the old behaviour, and it
updates a variable name accordingly.
2012-06-29 15:09:34 +02:00
Holger Weiss
973d147cef check_smtp: Fix help and usage output regarding -R 2012-06-29 14:25:40 +02:00
Anders Kaseorg
638b596992 check_smtp: Fix strcat overflows
Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2012-06-29 13:39:11 +02: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
Anders Kaseorg
9976876584 check_smtp: Strip angle brackets from -f argument, if provided
Apparently some people used -f '<nagios@example.com>' to work around
the bug I just fixed in the MAIL FROM: command generation.  Although
the resulting command wasn't RFC-compliant, it was working with some
MTAs, so let's continue to support this syntax now that we generate
RFC-compliant commands.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2012-06-29 13:39:11 +02:00
Anders Kaseorg
dd1e9eb5ea check_smtp: Change MAIL FROM: command to comply with the SMTP standard
Every version of the SMTP standard (from RFC 821 to the current RFC
5321) requires the address following MAIL FROM: to follow the colon
immediately (with no space) and to be surrounded by angle brackets.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
2012-06-29 13:39:11 +02:00
Holger Weiss
cbc8a7f313 check_tcp: Print performance data even with -D
When using the 1.4.15 release of the Nagios Plugins, a command such as

  check_tcp -H pop.example.com -p 995 -D 14

usually produced two lines of output, e.g.:

  OK - Certificate will expire on 12/13/2014 23:59.
  TCP OK - 0.009 second response time on port 995|time=0.008849s;;;0.000000;10.000000

The second line was removed by 4d06603060.
However, as the old two-line output is a valid (though in this case
unintended) way to spit out performance data, removing the second line
might break current setups.  Therefore, we revert to the old behaviour,
at least for the moment.

The issue was reported by Jochen Bern on the "nagiosplug-devel" mailing
list (Message-ID: <4FEAE812.8030309@LINworks.de>).
2012-06-27 17:29:11 +02:00
Sven Nierlein
843f954056 check_snmp: use single quotes for perf data labels 2012-06-27 00:02:09 +02:00
Sven Nierlein
9c886d049d Fix performance data label containing spaces in check_snmp (Jochen Bern)
Add --perf-oids option for check_snmp to retain optional 1.4.14 compatibility
2012-06-26 20:53:13 +02:00
William Leibzon
181260d636 added test case for certificate checs with both warning and critical values 2012-06-25 12:54:15 +02:00
Sven Nierlein
24242f6ab7 check_http: added test for warning thresholds
fixed typo in sslutils
2012-06-25 12:53:47 +02:00
William Leibzon
fa3d2a4074 applied patch that adds both critical and warning thresholds to certificate expiration checks of check_tcp, check_http, check_smtp 2012-06-25 12:05:16 +02:00
Holger Weiss
88fdf3a8a8 check_ping: Add missing newline to die() calls
Our die() function expects the caller to append the trailing newline
character.
2012-06-25 01:58:17 +02:00
Holger Weiss
bf7c4f95ae Merge remote-tracking branch 'github/waja/master'
Conflicts:
	NEWS
2012-06-25 01:14:12 +02:00
Holger Weiss
991054fa6e check_ping: Ignore ping(1)'s exit status
Don't return a WARNING state if the number of lost packets is greater
than zero but below the specified warning threshold.  This happened
because the check_ping plugin used the exit status of the ping(1)
utility.  (#3535140 - Tobias Brox)
2012-06-24 15:51:56 +02:00
Holger Weiss
e6df238350 Fix check_by_ssh test for non-Bash login shells
In the C shell and in the Z shell, the "?" character must be quoted or
backslash-escaped in order to use it verbatim.  Therefore, a command
such as

	check_by_ssh -H test.example.com -l joe echo huh?

might fail, depending on joe's login shell on test.example.com.

Just to make sure, this commit removes most punctuation characters from
our test strings.
2012-06-22 17:11:18 +02:00
Holger Weiss
a80eafbf9c Improve parsing of ping6(1) output
The ping6(1) implementation provided by Debian's iputils-ping package
may produce output such as the following:

| 3 packets transmitted, 0 received, +3 errors, 100% packet loss, time 2009ms

There's a corresponding pattern in check_ping.c:458:

| "%*d packets transmitted, %*d received, +%*d errors, %d%% packet loss"

Without this fix, the pattern in check_ping.c:456 matched first (as
sscanf(3) interprets "+3" as a match for "%d"):

| "%*d packets transmitted, %*d received, %d%% loss, time"

(#1894850 - Debian bug report #514588 - Matej Vela)
2012-06-11 23:40:04 +02:00
Holger Weiss
4e9eedc8de Fix whitespace and capitalization issues
Fix indentation and whitespace issues, and correct some capitalization
errors in error messages.  The behaviour is unchanged.
2012-06-11 23:34:15 +02:00
Holger Weiss
3fd1bd97ca Don't use SSLv2 when compiling against GnuTLS
GnuTLS doesn't support SSL version 2.
2012-06-11 23:23:40 +02:00
Sebastian Harl
e056cc9d82 t/check_dbi.t: Don't use 'INSERT … VALUES (a,b), (c,d)' with SQLite3.
Older versions of SQLite3 don't seem to support that.
2012-06-08 13:18:07 +02:00
Sebastian Harl
8455419650 Added a few test cases for the check_dbi plugin.
All tests use sqlite3. A temporary database is created for the purpose of the
tests.
2012-06-08 11:14:21 +02:00
Holger Weiss
094a6fa2f3 check_users: Whitespace fixes, etc. 2012-06-07 10:43:15 +02:00
M. Remy
3e622f3a47 check_users: improve performance
This patch use the utxent function family to collect the user data. It improve the check speed.
Need a system conforming to POSIX.1-2001.
2012-06-07 10:14:16 +02:00
Sebastian Harl
ce75adf287 check_dbi: Hint the user about cause when dbi init fails. 2012-06-06 15:06:44 +02:00
Sebastian Harl
022ba7ea3a check_dbi: Added simple regex example to help output. 2012-06-06 14:10:55 +02:00
Sebastian Harl
14fc0f741d check_dbi: Added SERVER_VERSION metric.
This metric compares the database engine server version with the specified
ranges. The version string [[[[A.]B.]C.]D.]E[.] is returned as E + D*100 +
C*10000 + B*1000000 + A*100000000 (see libdbi's dbi_conn_get_engine_version()
documentation).
2012-06-06 14:10:55 +02:00