Commit graph

1383 commits

Author SHA1 Message Date
Thomas Guyot-Sionnest
4caf4ce4fe Rename ENV variable, keep backward compatibility
Rename NAGIOS_PLUGIN_STATE_DIRECTORY to MP_STATE_DIRECTORY
2014-01-25 03:35:46 -05:00
Jan Wagner
455fe96e7d check_ping: Fixing "time of day goes back"
by Geoff Oakham <goakham at oanda.com>

Patch of check_ping that allows it to gracefully handle when ping outputs
to stderr "Warning: time of day goes back (-XXXXus), taking countermeasures."

Closes: #809 and #1195
2014-01-24 18:33:37 +01:00
Jan Wagner
ccecba33a2 Fixing bug in average calculation (Submitted by Lars)
The more important change: A fix for a bug which caused the check_ntp_time
and check_ntp_time check to always take the first response from ntp and not
the avarage since "j" is not increased anywhere. "i" should be used there
instead.

Partly Closes #956 and Closes #1166
Closes: #1089
2014-01-24 18:20:08 +01:00
Jan Wagner
c5dc81cd28 Making AVG_NUM configurable by compiler define (Submitted by Lars)
A minor change which makes the AVG_NUM configurable by compiler define.
Partly Closed #956 and Closes #1166
2014-01-24 17:55:57 +01:00
Tilmann Bubeck
c4a99b023d fix smart attribute comparison
Each S.M.A.R.T. attribute is compared against a threshold. If it is LESSTHAN
that threshold an error is reported.  This patch fixes the problem, that
attribute values EQUAL to the threshold are reported as error, which is wrong.
Only LESSTHAN the threshold is an error.

For more information see: http://www.hdsentinel.com/smart/index.php

My SSD has some attributes which value and threshold are "0". Without the patch
this is reported as errornous.

ID# ATTRIBUTE_NAME FLAG VALUE WORST THRESH TYPE UPDATED WHEN_FAILED RAW_VALUE
...
172 Unknown_Attribute 0x0032 000 000 000 Old_age Always - 0
174 Unknown_Attribute 0x0030 000 000 000 Old_age Offline - 13
177 Wear_Leveling_Count 0x0000 000 000 000 Old_age Offline - 0
...

See also:

* http://sourceforge.net/p/nagiosplug/patches/365/
* https://bugzilla.redhat.com/913085
2014-01-23 08:56:53 -05:00
Thomas Guyot-Sionnest
0fbee4deb2 Fix misleading option text
As soon as a device is specified without using -d, anything else on the
command line is ignored.
2014-01-23 03:19:06 -05:00
Thomas Guyot-Sionnest
d080c3ad97 Disable SMART test commands in check_ide_smart
check_ide_smart could disable offline auto tests but could not re-enable
them. For this reason all SMART command modes have been disabled

The disabled commands are -0/--auto-off, -1/--auto-on and
-i/--immediate
2014-01-23 03:17:55 -05:00
Thomas Guyot-Sionnest
fd20a72ad6 Remove accidental tabs inserted in macro 2014-01-23 03:06:21 -05:00
Thomas Guyot-Sionnest
b5cc2928e2 Make check_ide_smart default to nagios output
check_ide_smart was originally a smard control utility later converted
to a monitoring plugin. the -n option (Nagios check) should therefore be
the default.

This patch deprecates the -n and -q switches, and make the other
switches return nagios-compatible output (they are most likely used in
eventhandlers, but returning nagios-compatible output makes it clear and
easy to handle the return status)
2014-01-23 02:41:26 -05:00
Ricardo Maraschini
82033b35b1 plugins/utils.h: avoiding warnings on empty printf statements
while compiling i keep receiving an warning statement as follow:

warning: zero-length gnu_printf format string

using an unorthodox method to remove them

Signed-off-by: Ricardo Maraschini <ricardo.maraschini@gmail.com>
2014-01-22 16:11:57 +01:00
Holger Weiss
01e570f4a4 Capitalize "Monitoring Plugins"
"Monitoring Plugins" is a name.
2014-01-21 16:19:20 +01: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
Thomas Guyot-Sionnest
11cf54ca78 Merge branch 'rename' 2014-01-21 07:59:07 -05:00
Holger Weiss
6141cfebf6 New default installation prefix: /usr/local
Install into /usr/local instead of /usr/local/nagios by default, in
order to comply with the Filesystem Hierarchy Standard (FHS) and
presumably the expectations of most users.
2014-01-21 13:17:36 +01:00
Spenser Reinhardt
66544851f7 plugins/*.c: Non-network timeout changes
Changes to non-network checks for clarity on timeout value. Adapted from pull request #1209 tracker from user awiddersheim. (Closes: #1209)
Files: check_apt.c, check_disk.c, check_procs.c, negate.c
2014-01-21 11:35:07 +01:00
Spenser Reinhardt
80e506a2f7 plugins/utils.h: Addition of plugin timeout msg.
Addition of timeout message for non-network plugins(UT_PLUG_TIMEOUT), and alteration of UT_TIMEOUT to UT_CONN_TIMEOUT for networked checks. Alteration of pull request #1209 tracker by user awiddersheim.
2014-01-21 11:34:33 +01: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
Jan Wagner
96f45b6698 Revert renaming value
As suggested by sreinhardt in 045d38a6 over there in nagios-plugins
2014-01-21 11:08:07 +01:00
awiddersheim
fc01a54e93 Add performance data to check_mysql_query.c (Closes: #1202) 2014-01-21 11:03:14 +01:00
Holger Weiss
c3e756a855 Capitalize "Monitoring" when it's the first word 2014-01-20 03:12:50 +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
Jan Wagner
a387120182 check_ssh: Get rid of sshd: Read from socket failed: Connection reset by peer
This fix was grabbed from FreeBSD downstream and provided by Dmitry Sivachenko.
Fixes Debian Bug #734811
2014-01-10 15:56:30 +01: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
Joseph Gooch
cadf0d7ba8 Fix for SSL Versioning when multiple options are used.
If you specify -S1 -C 30... The -C option will reset the ssl_version to 0.  This is not a good thing.

Instead we set the default to 0 and retain the version when later args are passed.
2013-12-20 17:30:14 +01:00
Holger Weiss
c91ff7539a check_http: Don't let "-N" expect an argument
Fix the problem that check_http's "-N" option expects an argument
although it shouldn't.  The corresponding long option ("--no-body")
wasn't affected.

This error was introduced in ee3c4014d5.
Thanks to Kerry Hughes for reporting it on the devel@ list.
2013-12-05 20:13:31 +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
3c90a370ea Update URLs and mailing list addresses
Now that we moved our infrastructure away from SourceForge, update the
URLs and mailing list addresses accordingly.
2013-10-28 23:58:36 +01:00
Holger Weiss
ef35403c26 Update web site URLs
The Nagios Plugin Development Guidelines and the Extra-Opts
documentation were moved to our new project server.
2013-10-08 16:09:42 +02: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
awiddersheim
d4c5730464 Die on SSL initialization errors
Fixes issue where if an SSL initialization error occurs on a redirect
using -f follow the plugin still returns an OK state.

Closes #1159.
2013-09-26 17:01:28 +02:00
Holger Weiss
6f0366c8b8 check_pgsql: Don't exit UNKNOWN instead of OK
Since commit 912df3ef9b, check_pgsql
exited UNKNOWN instead of OK if the new --query option was *not*
specified.  This bug is fixed now.
2013-09-19 12:41:42 +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
982cbeea00 check_disk: get_fs_usage hasn't been run if using groups
the reason why it still worked sometimes was fsu_blocks beeing uninitialized
which resulted in a true test sometimes.
2013-09-16 15:30:56 +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
cb8390aec9 check_tcp: use receive timeout for checks that expect response
if check_imap expects a string that never occurs, it currently waits forever
because thats how the imap protocoll works. Use a receive timeout in that case
so we can exit early with a proper error message.
2013-09-15 20:49:36 +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
c7d6730255 check_load: add alternative uptime syntax
check_load parses load from the uptime command if no proc filesystem is available. Seems
like there are at least 2 different uptime outputs.

linux:
 20:44:34 up 25 days,  2:07, 13 users,  load average: 0.13, 0.17, 0.22

freebsd 8:
 8:44PM  up  4:29, 1 user, load averages: 0.00, 0.00, 0.00
2013-09-14 20:44:54 +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
8b1c574298 fping: some fping versions set loss to 0% by mistake
fping v2.4b2 returns
10.99.0.1 : xmt/rcv/%loss = 0/0/0%
for a failed host, so we assume the host is down if xmt is zero
2013-09-13 17:14:33 +02:00
Sven Nierlein
4933146e00 check_snmp: add timeout handler befor running snmpget 2013-09-12 23:39:32 +02:00
Sven Nierlein
c0926c2b1e check_tcp: only test ipv6 if ping6 works 2013-09-12 23:39:31 +02:00
Holger Weiss
ffad261eab check_tcp: Fix checks without --expect string
Commit e8044713d4 broke check_tcp checks
without --expect string, this commit fixes that regression.
2013-09-12 22:36:35 +02:00