Commit graph

168 commits

Author SHA1 Message Date
Sven Nierlein
2acf9a63d3 check_dns: added test for nonresponsive dns server (#982)
Signed-off-by: Sven Nierlein <sven@nierlein.de>
2014-07-30 11:49:50 +02:00
Holger Weiss
c5a64eeef8 plugins/t/check_dns.t: Fix Perl warning
Perl said: "Unrecognized escape \d passed through at ./t/check_dns.t
line 57."
2014-07-21 13:59:22 +02:00
Jan Wagner
71063655e5 travis-ci: Adding ports for check_hpjd 2014-07-20 23:36:18 +02:00
abrist
479509ad59 added tests for check_hpjd port options
---
Closes #1160 and #973
2014-07-20 23:36:05 +02:00
abrist
78d00d338a check_ntp.t - fixed tests for new status output
closes #1236 and #1239
2014-07-20 23:35:03 +02:00
Mikael Falkvidd
f54d10fe9b check_procs: Add delay after forking in test
Forking raises a race condition, where the parent might run the
test before the child has had time to fork. If that happens,
an error similar to this is produced:
 Failed test 'Output correct'
 at ./t/check_procs.t line 32.
                 'PROCS OK: 0 processes with args 'sleep 7' | processes=0;;;0;'
   doesn't match '/^PROCS OK: 1 process?/'

Sleeping a bit should avoid the problem. It might be enough to
sleep less than a second, but perl's built-in sleep function only
supports integer seconds.

In our build environment, the build failed 3 of 4 times before
this patch. After the patch it failed 0 of 7 times.

Signed-off-by: Mikael Falkvidd <mfalkvidd@op5.com>
2014-07-10 21:10:48 +02:00
Jan Wagner
b62f2c14fb Merge PR #1265 from waja/check_tcp_server_addr 2014-06-30 15:13:39 +02:00
abrist
4277f47bff check_jabber.t - fixed tests for new status output including hostname 2014-06-30 13:55:42 +02:00
Sven Nierlein
e566021a54 tests: added check_dns performance data test
Signed-off-by: Sven Nierlein <sven@nierlein.de>
2014-06-28 22:05:25 +02:00
Sven Nierlein
b35d12e931 tests: always build and test on travis
also make test is now working on travis-ci

Signed-off-by: Sven Nierlein <sven@nierlein.de>
2014-06-24 15:07:44 +02:00
Sven Nierlein
93901d5ff1 tests: fping checks require being root or setuid root
on the fping binary. Check this before running the test.

Signed-off-by: Sven Nierlein <Sven.Nierlein@consol.de>
2014-06-13 15:23:18 +02:00
Anton Lofgren
4e0da0216d check_snmp: Handle SNMPv3 noAuthNoPriv properly
The SNMPv3 noAuthNoPriv security level, somewhat unintuitively, requires
a security name to be passed along together with the request. Check_snmp
previously did not do this, causing snmpget to throw an error:

"External command error: No log handling enabled - turning on stderr
logging
snmpget: No securityName specified"

This patch fixes the issue by always providing the security name when
noAuthNoPriv is specified.

See also:
https:://bugs.op5.com/view.php?id=8385.

Signed-off-by: Anton Lofgren <alofgren@op5.com>
2014-04-24 08:49:54 +02:00
Thomas Guyot-Sionnest
fc9fbe1e89 Typo 2014-01-29 02:16:47 -05:00
Thomas Guyot-Sionnest
c30be5877c Clarify check_mysql test prompts
Also default to "-u test -ptest" which are default MySQL accounts only
missing the prescribed privileges.

The database is no longer specified as it is not used.
If wanted is should be its own parameter/tests.
2014-01-28 02:35:09 -05:00
Holger Weiss
7ee3525423 Merge branch 'maint'
* maint:
  check_ssh: Get rid of sshd: Read from socket failed: Connection reset by peer
  fixed tests when there is no direct internet connection
  NEWS: Mention fix for check_http's -S option
  Fix for SSL Versioning when multiple options are used.
  Fix #1217 spec file fails to build due to duplicate files and unused files
  check_http: Don't let "-N" expect an argument
  README: Change GitHub URL
  README: Clarify license notice
  Update URLs and mailing list addresses
  Just using the posix conform extended regular expression grep
  check_oracle: --db +ASM bad string matching check_oracle doesn't correctly check for pmon +ASM instance from at least Oracle 11 as the pmon proces was renamed from ora_pmon_.* to asm_pmon_.*. -- Just turning attached patch of github issue #1207 into a push request. (Closes #1207)
  Update web site URLs

Conflicts:
	FAQ
	NEWS
	README
	SUPPORT
	configure.in
	monitoring-plugins.spec.in
	pkg/solaris/pkginfo.in
	plugins-root/check_dhcp.c
	plugins-root/check_icmp.c
	plugins-scripts/check_ifoperstatus.pl
	plugins-scripts/check_mssql.pl
	plugins/check_apt.c
	plugins/check_by_ssh.c
	plugins/check_cluster.c
	plugins/check_dbi.c
	plugins/check_dig.c
	plugins/check_disk.c
	plugins/check_dns.c
	plugins/check_dummy.c
	plugins/check_fping.c
	plugins/check_game.c
	plugins/check_hpjd.c
	plugins/check_http.c
	plugins/check_ide_smart.c
	plugins/check_ldap.c
	plugins/check_load.c
	plugins/check_mrtg.c
	plugins/check_mrtgtraf.c
	plugins/check_mysql.c
	plugins/check_mysql_query.c
	plugins/check_nagios.c
	plugins/check_nt.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_swap.c
	plugins/check_tcp.c
	plugins/check_time.c
	plugins/check_ups.c
	plugins/check_users.c
	plugins/negate.c
	plugins/urlize.c
	plugins/utils.h
	po/Makevars
	po/de.po
	po/fr.po
	po/monitoring-plugins.pot
2014-01-21 16:07:38 +01:00
Holger Weiss
a8c9b696f4 Minor fixes to be amended into "rename" commit 2014-01-20 03:01:55 +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
Sven Nierlein
d8354ec15d fixed tests when there is no direct internet connection
- check http had wrong number of skipped tests
 - check tcp did not use the 'no internet' flag at all
2013-12-27 01:14:50 +01:00
Sven Nierlein
4ab4c8dd32 make testing check_proc not rely on bash
also grandparents make this test fail but is not a problem in real live.
NPTest->testCmd uses "sh -c" already, so there is no need to do that twice.
2013-11-20 21:42:25 +01:00
Anton Lofgren
77fc3548ae check_procs: ignore plugin parent process
This fixes an issue that appears when running check_procs over NRPE,
where the default shell is configured to (for example) dash, as is the
case on Debian.

dash (and tcsh, and mksh, and probably others), when invoked with -c forks an additional process
to execute the argument string. Contrast this with bash, which does not
do this, provided that the argument string simply can be exec()'d as-is.

To demonstrate:
$ bash -c pstree
init─┬ ..
    ...
	├─sshd─-─sshd───pstree

versus
$ dash -c pstree
init─┬ ..
    ...
	├─sshd─-─sshd───dash───pstree

The consequence of this fork is that the following invocation:
    /opt/plugins/check_procs -a init

will result in this output:

    PROCS OK: 2 processes with args 'init' | processes=2;;;0;

because the check_procs, in addition to finding the actual init process,
finds its parent shell as well.

This example is a bit contrived, but I think it illustrates the
point.

This wouldn't really be a problem, and normally isn't, if it weren't
for the fact that NRPE uses a call to popen() which does exactly the
above (executes '/bin/sh -c ...'), causing inconsistent behaviour
between distributions and much confusion for end users.

The argument may be made that the dash process spawned by NRPE is just a
process like any other, and should therefore be included in the process
count just like any other. However, this is not very intuitive, because
of the previously mentioned inconsistencies.

The argument might also well be made that we're _never_ interested in the
immediate ancestor of the plugin, and while it is unknown how many
installations have already made the necessary modifications to their
setups to make up for the fact that the plugin behaves the way it does,
it is not deemed worthwhile to entertain such workarounds.

Thus, this patch ignores the parent process.

See also these bug reports:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=626913
http://sourceforge.net/p/nagiosplug/bugs/512/
https://github.com/nagios-plugins/nagios-plugins/issues/999
https://bugs.op5.com/view.php?id=4398
2013-11-19 23:57:27 +01:00
Holger Weiss
aac0980edb Change default host names for some tests
Testing "nagiosplugins.org" will currently not work.
2013-09-29 00:14:17 +02:00
Sven Nierlein
065905e900 check_disk: die with a reasonable error message if one mount point hits average value 2013-09-17 20:12:32 +02:00
Sven Nierlein
9090beb058 check_ssh: added test case 2013-09-17 12:13:51 +02:00
Sven Nierlein
b83904c528 check_by_ssh: tests expand key and config path
some systems do not expand the path automatically.
2013-09-17 11:34:06 +02:00
Sven Nierlein
ddff48fb25 check_udp: skip tests which rely on udp listen
solaris netcat does not listen in udp mode due to
http://sourceforge.net/p/netcat/bugs/27/
2013-09-17 11:23:12 +02:00
Sven Nierlein
adc9d71b4b check_procs: fix test with sleeping processes
at least on freebsd, there are a processes with state 'S', they always
use two character status.
2013-09-16 13:49:44 +02:00
Sven Nierlein
c001fb98ff check_http: tests use supplied value if possible 2013-09-16 13:49:44 +02:00
Sven Nierlein
c900ee2772 check_ping: increase test timeout
freebsds ping takes a few seconds till it returns, so a 1 second timeout does
not work for the test.
2013-09-14 21:06:26 +02:00
Sven Nierlein
6361247b4c check_udp: try nc.traditional too
nc.traditional is available on (at least) ubuntu systems and uses traditional nc syntax
2013-09-14 19:59:17 +02:00
Sven Nierlein
7b122f13db tests: move ipv6 detection into NPTest module 2013-09-14 19:36:20 +02:00
Sven Nierlein
32ec6265a4 unified nc syntax
older netcats do not understand -p, they expect host and port as additional argument.
This is backwards compatibel to newer clients. Also support netcat instead of nc.
2013-09-13 23:08:07 +02:00
Sven Nierlein
c0926c2b1e check_tcp: only test ipv6 if ping6 works 2013-09-12 23:39:31 +02:00
Sven Nierlein
817ea52cc0 fixed check_tcp test
A check with thresholds 9000,1 must exit with warning if the certificate expires in less
than 9000 but more than one day.
2013-08-21 17:48:14 +02:00
Sven Nierlein
d57941c4d2 check_snmp: added threshold tests 2013-08-21 15:59:56 +02:00
Holger Weiss
4a3901ec70 plugins/t/check_procs.t: Expect performance data
The check_procs plugin now emits performance data, fix the test(s)
accordingly.
2013-08-17 21:59:45 +02:00
Holger Weiss
29b2dfab4f plugins/t/check_apt.t: Expect performance data
The check_apt plugin now emits performance data, fix the test(s)
accordingly.
2013-08-17 21:52:50 +02:00
Sven Nierlein
ec537bc463 cleanup after check_http patch (fixes #50)
- cleanup whitespace
  - added test cases
  - print time_ssl only if ssl is in use
  - updated news and thanks file
2013-08-15 17:28:49 +02:00
Sven Nierlein
2e6a0138de corrected http test
multiple headers have to be set by multiple -k switches. Seperating them
by semicolons is not longer supported as semicolons are valid characters in
http headers.
2013-08-15 11:10:04 +02:00
Sven Nierlein
5fce5ceaeb check_tcp: don't ignore trailing options
"./check_tcp -6 -p 80 host" leads to an error:
TCP CRITICAL - Invalid hostname, address or socket: 127.0.0.1
because 127.0.0.1 is the fallback host, the tailing hostname
was ignored.
2013-02-10 23:09:49 +01:00
Sven Nierlein
307da669ee Merge pull request #20 from abradley/aptcritical
Fixes for check_apt handling of -i/-e/-c regexps and SECURITY_RE, plus tests
2013-01-23 11:43:26 -08:00
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
Alex Bradley
13e85a0f4f Tests for check_apt
Add a hidden "--input-file" option to check_apt (modelled on
check_procs) so that it can take files with sample apt output as input.

Add tests for my SECURITY_RE fix (debian3) and for the include, exclude
and critical options.
2012-10-03 15:54:24 -07:00
Holger Weiss
800a868713 Merge remote-tracking branch 'github/tokkee/sh/check_dbi' 2012-07-04 23:50:48 +02:00
Sven Nierlein
24242f6ab7 check_http: added test for warning thresholds
fixed typo in sslutils
2012-06-25 12:53:47 +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
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
Sven Nierlein
83655083af check_by_ssh: added -F config file to specify alternative ssh config 2012-04-09 22:16:39 +02:00
Thomas Guyot-Sionnest
4611e41bc5 check_http: check for and print the certificate cn
This patch adds a check for the certificate cn (hostname) to normal
certificate checks. It returns CRITICAL if th cn is missing, otherwise it
prints it in the normal output.

Patch by Stéphane Urbanovski
2011-02-04 00:54:52 -05:00
Thomas Guyot-Sionnest
ae2a669137 Test updates...
1. Timetick test could fail with uptime > 115 days. Thresholds are
double type, so it's safe to put a large number even for 32bit systems.
2. Add a test based on an invalid bug report, worthy anyway.
2011-01-05 23:09:54 -05:00