From 060ec72678019f5be60726c9288a33a825693e88 Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Wed, 15 Oct 2014 14:48:52 +0200 Subject: [PATCH] Imported Upstream version 2.1 --- ChangeLog | 537 +++++++++++++++++++++++---- FAQ | 36 -- Makefile.am | 2 +- Makefile.in | 21 +- NEWS | 28 ++ NP-VERSION-GEN | 2 +- THANKS | 10 + config.h.in | 5 +- configure | 35 +- configure.ac | 12 +- lib/utils_base.c | 15 +- monitoring-plugins.spec | 201 ---------- monitoring-plugins.spec.in | 201 ---------- pkg/solaris/pkginfo | 4 +- plugins-scripts/check_file_age.pl | 5 +- plugins-scripts/check_ifstatus.pl | 59 ++- plugins-scripts/check_log.sh | 7 +- plugins-scripts/check_mailq.pl | 4 +- plugins-scripts/check_oracle.sh | 5 +- plugins-scripts/check_sensors.sh | 5 +- plugins-scripts/t/check_disk_smb.t | 2 +- plugins-scripts/t/check_file_age.t | 8 +- plugins/check_by_ssh.c | 3 +- plugins/check_dig.c | 9 +- plugins/check_disk.c | 16 +- plugins/check_dns.c | 22 ++ plugins/check_hpjd.c | 30 +- plugins/check_mysql.c | 22 +- plugins/check_ntp_peer.c | 58 ++- plugins/check_ntp_time.c | 15 +- plugins/check_tcp.c | 2 +- plugins/netutils.c | 15 +- plugins/sslutils.c | 9 +- plugins/t/NPTest.cache.travis | 2 + plugins/t/check_dns.t | 14 +- plugins/t/check_hpjd.t | 35 +- plugins/t/check_ntp.t | 4 +- plugins/t/negate.t | 5 +- plugins/tests/check_http.t | 8 +- plugins/tests/check_snmp.t | 11 +- po/de.gmo | Bin 7632 -> 7632 bytes po/de.po | 540 ++++++++++++++------------- po/fr.gmo | Bin 91740 -> 91740 bytes po/fr.po | 541 ++++++++++++++------------- po/monitoring-plugins.pot | 569 +++++++++++++++-------------- release | 2 +- test.pl.in | 2 + 47 files changed, 1718 insertions(+), 1420 deletions(-) delete mode 100644 monitoring-plugins.spec delete mode 100644 monitoring-plugins.spec.in diff --git a/ChangeLog b/ChangeLog index ea57b8c..1dca3bd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,464 @@ +2014-10-15 Holger Weiss + + * NEWS, NP-VERSION-GEN, configure.ac: Prepare for the 2.1 release + + * THANKS.in: Add new authors + + Update the THANKS.in file with the new Git commit authors. + + * FAQ: Remove outdated (RPM/DEB-related) questions + + * NEWS: Mention that we dropped the spec file + +2014-10-15 Jan Wagner + + * Makefile.am, configure.ac, monitoring-plugins.spec.in: Removing the + spec file, as it's broken + Even we have none feedback in PR #1283 + +2014-10-08 Holger Weiss + + * plugins-scripts/check_ifstatus.pl: check_ifstatus: Fix "-n" and "-u" + options + + Ignore interface if it's specified via "-n" OR "-u", not just when it's + specified via "-n" AND "-u". + +2014-10-06 Holger Weiss + + * lib/utils_base.c: Revert "Make use of xasprintf instead of asprintf" + + This reverts commit a143739ed286cf9ae003792dbb1ce26ce43f3312. + + Our current setup doesn't allow lib/*.c files to call functions defined + in plugins/utils.[ch]. + +2014-09-23 Jonas Genannt + + * NEWS, plugins-scripts/check_file_age.pl, + plugins-scripts/t/check_file_age.t: check_file_age: Provide performance + data + +2014-10-06 Jan Wagner + + * NEWS: Adding missing informations to NEWS + +2014-09-29 Jan Wagner + + * THANKS.in: Adding Simon to Thanks file + +2014-09-01 Simon Meggle + + * plugins-scripts/check_mailq.pl: check_mailq: fixed mailer names + + (Closes #1289) + +2014-09-16 Holger Weiss + + * NEWS, plugins/check_tcp.c: Fix check_jabber to work with Openfire + servers + + The plugin expected: + + + + But Openfire sends: + + + +2014-09-10 Holger Weiss + + * NEWS: Mention new check_ifstatus option + +2013-05-13 Nick Peelman + + * plugins-scripts/check_ifstatus.pl: Add check_ifstatus option to ignore + interfaces by name + + Ignoring by index is not always an option, as the index can change on + chassis switches as blade configurations change. + +2014-07-30 Jan Wagner + + * .travis.yml: travis-ci: create MySQL database 'test' + +2014-07-21 Jan Wagner + + * .travis.yml: travis-ci: Installing libhttp-daemon-ssl-perl to make + plugins/tests/check_http.t possible to run + + * .travis.yml: travis-ci: Using libfreeradius-client-dev as build-dep + +2014-08-20 Jan Wagner + + * plugins-scripts/check_log.sh, plugins-scripts/check_oracle.sh, + plugins-scripts/check_sensors.sh: Setting PATH at first + + * plugins-scripts/check_log.sh: check_log.sh: droping path from basename + while evaluating PROGNAME (Closes Debian Bug #758662) + +2014-08-06 Sven Nierlein + + * plugins/check_by_ssh.c: check_by_ssh: added --hostname support + + just like the guidelines and the help already suggests. + +2014-07-31 Sven Nierlein + + * plugins/tests/check_snmp.t: tests: skip extented snmp tests if snmpd + has no perl support + + solaris snmpd has no perl support by default, so this test will fail. + + * plugins/t/negate.t: tests: negate test fails when not run from plugins + folder + + * plugins/t/negate.t: tests: get current directory the perl way + + instead of hoping to have it in the environment. This at + least broke tests on solaris. + + * plugins/check_dns.c: check_dns: unified check output + + this also allows us to make tests against "critical" in the output. + + * plugins-scripts/t/check_disk_smb.t: tests: check_disk_smb may exit + with critical for unresponsive hosts too + + Unknown (ex. debian 7) + %> ./check_disk_smb -H 1.1.1.1 -s np_foobar -vvv + /usr/bin/smbclient //1.1.1.1/np_foobar -U guest% -c du + No Answer from Client + + Critical (ex. debian 8) + %> ./check_disk_smb -H 1.1.1.1 -s np_foobar -vvv + /usr/bin/smbclient //1.1.1.1/np_foobar -U guest% -c du + Connection to 1.1.1.1 failed + CRITICAL + +2014-07-31 Sven Nierlein + + * plugins/check_ntp_peer.c: check_ntp_peer: do not use uninitialized + results for max state + + s/t/jresult are not initialized if there is no corresponding threshold + supplied. So we shouldn't use them for calculating our result. + +2014-07-31 Holger Weiss + + * NEWS: Mention --with-qmail-qstat-command option + +2013-10-21 awiddersheim + + * configure.ac: Fix PATH_TO_QMAIL_QSTAT in configure + + When configuring PATH_TO_QMAIL_QSTAT the PATH_TO_MAILQ would get applied + instead after tests had passed. Also made --with-qmail-qstat-command a + configuration option. + +2013-09-30 Jan Wagner + + * THANKS.in: adding to THANKS + +2014-07-30 Jan Wagner + + * plugins/check_dns.c: check_dns: Use strchr instead of index + + * THANKS.in: Adding Alexander Wittig to THANKS.in + --- + Closes #1218 + Closes #1281 + +2013-12-16 Alexander Wittig + + * plugins/check_dig.c: 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) + + * plugins/check_dig.c: 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 Sven Nierlein + + * tools/generate-change-log: workaround for broken Text::Wrap + + workaround for broken Text::Wrap: + "This shouldn't happen at /usr/share/perl/5.18/Text/Wrap.pm line 84." + changing huge to overflow make generating changelogs work again at + the price of not having changelog strictly cut of at 80 columns + anymore. Words longer than 80 characters will now printed in one + line. This mainly affects old sf.net urls. + + * tools/generate-change-log: no need for the signed off messages in our + changelog + +2014-07-30 Jan Wagner + + * lib/utils_base.c: Make use of xasprintf instead of asprintf + --- + Closes #1278 + +2014-01-22 Ricardo Maraschini + + * lib/utils_base.c: if asprintf fails, string is undefined + + if asprintf fails, string content becomes invalid. we need + to check if it ran OK by checking the returned value. + + in case of fail, asprintf returns -1, otherwise the number + of writen bytes is returned. + + also, on ubuntu 13.10 i've receiving a lot of warnings: + + "warning: ignoring return value of ‘asprintf’" + + this patches fixes some of them + +2013-09-29 Jan Wagner + + * plugins/check_dns.c: check_dns: returns incorrect state when + specifying server + + This patch verifies if the response is returned by the dns server we + are trying to check + --- + Closes #981 + Closes #982 + Closes #1164 + +2014-07-30 Jan Wagner + + * .travis.yml: travis-ci: create MySQL database 'test' + +2014-07-30 Sven Nierlein + + * plugins/t/check_dns.t: check_dns: added test for nonresponsive dns + server (#982) + +2014-07-29 Jan Wagner + + * THANKS.in: Adding Jason Benguerel + +2013-10-01 Jan Wagner + + * plugins/check_disk.c: check_disk: show troubled partition in verbose + mode + + I'm submitting a small patch to check_disk that will show which partitions are + actually causing the error state. This helps the human operator to quickly + identify the exact issue. I made it so a single -v flag is required so it + doesn't harm legacy code that may be parsing the original style of output. + + Thanks to Jason Benguerel. + --- + Closes #984 + Closes #1182 + +2014-02-05 abrist + + * plugins/check_ntp_time.c: check_ntp_time.c - Cleaned up usage and + added a note + + Closes #907 + Closes #1184 + +2014-07-21 Jan Wagner + + * THANKS.in: Adding Patrick McAndrew to THANKS.in + +2013-10-01 Jan Wagner + + * plugins/check_ntp_time.c: check_ntp_time: adding offset option + + Not sure if this is of use or not - we have a strange requirement to run + certain servers 5 minutes fast. I've added a switch to the check_ntp_time + to allow for this offset. + + Thanks to Patrick McAndrew. + +2014-05-19 abrist + + * plugins/netutils.c: netutils.c - A few more changes + + Changed bool to short. + + Removed first instance of is_socket to avoid + redeclaration error. + + Changed 'socket' to 'file socket' for verbosity. + +2014-05-07 Davide Madrisan + + * plugins/netutils.c: This patch will add the IP and port, or socket + name, to the error message and + thus simplify the problem debugging: no need to check for this information in + the Nagios configuration. + This function is only used by 'check_tcp.c'. + + Without the patch: + + $ ./plugins/check_tcp -H 127.0.0.1 -p 21 + Connection refused + $ ./plugins/check_tcp -H /var/spool/nagios/cmd/nagios.cmd + Permission denied + + With the patch: + + $ ./plugins/check_tcp -H 127.0.0.1 -p 21 + connect to address 127.0.0.1 and port 21: Connection refused + $ ./plugins/check_tcp -H /var/spool/nagios/cmd/nagios.cmd + connect to socket /var/spool/nagios/cmd/nagios.cmd: Permission denied + + Thanks to Davide Madrisan. + --- + Closes #1277 + +2013-10-01 Jan Wagner + + * THANKS.in, plugins/check_mysql.c: check_mysql: ignore authentication + failure + + This patch allows checking if MySQL server is running without providing valid + username and password. Similar to check_ssh plugin it returns MySQL server + version string and protocol number. + + Example: + check_mysql -n -H aaa.bbb.ccc.ddd + MySQL OK - Version: 5.0.51a-24+lenny5 (protocol 10) + + This is useful for monitoring servers where one does not have administrator + privileges or does not want to grant any privileges for the monitoring station. + + To enable this functionality new option --ignore-auth (-n) is added to + check_mysql plugin. + + Thanks to Julius Kriukas + + Closes #1020 + Closes #1178 + +2014-07-21 Jan Wagner + + * .travis.yml: travis-ci: Installing libhttp-daemon-ssl-perl to make + plugins/tests/check_http.t possible to run + +2014-07-21 Holger Weiss + + * test.pl.in: Use "C" locale when running test suite + + Some of our tests check locale-dependent plugin output, so let's make + sure "make test" is always using the "C" locale. + + * plugins/tests/check_http.t: Adjust date strings + + Adjust the expected date strings to the now-localized output produced by + plugins/sslutils.c. + + Closes #1275. + +2014-07-21 Jan Wagner + + * .travis.yml: travis-ci: Using libfreeradius-client-dev as build-dep + +2014-07-21 Holger Weiss + + * plugins/t/check_dns.t: Fix Perl warning + + Perl said: "Unrecognized escape \d passed through at ./t/check_dns.t + line 57." + +2013-10-01 Jan Wagner + + * THANKS.in, plugins/sslutils.c: sslutils: expire time in local timezone + format + + sshutils prints the expiry time of certificates in US format + this patch uses the strftime %c, I don't know how portable that is + + Thanks to Neil Prockter. + + Closes #1188 + Closes #1161 + Closes #977 + Closes #976 + Closes #975 + Closes #840 + Closes #382 + +2013-09-30 Jan Wagner + + * THANKS.in, plugins-scripts/check_ifstatus.pl: check_ifstatus: perfdata + bug + + The perfdata output violates the current Nagios Plugin Development Guidelines + (http://nagiosplug.sourceforge.net/developer-guidelines.html#AEN202 : + "space separated list of label/value pairs"). + + Thus the Addon PNP did not read the perdata correctly. + + The patch replaces the commas with spaces in the perfdata output. + + Many thanks to Patric Wust. + --- + Closes #1169 and #721. + +2014-07-20 Jan Wagner + + * plugins/t/NPTest.cache.travis: travis-ci: Adding ports for check_hpjd + +2014-01-27 abrist + + * plugins/t/check_hpjd.t: added tests for check_hpjd port options + --- + Closes #1160 and #973 + +2014-01-24 abrist + + * NEWS, plugins/check_hpjd.c: Added check_hpjd port option to news and + clarified the port usage error. + + * plugins/check_hpjd.c: check_hpjd - Added a switch for port + specification. Defaults to 161. + +2014-03-03 abrist + + * plugins/t/check_ntp.t: check_ntp.t - fixed tests for new status output + closes #1236 and #1239 + +2014-02-14 abrist + + * plugins/check_ntp_peer.c: check_ntp_peer - Added specific state output + for each metric. It now should be easy to see which check caused the + alert. + +2013-10-01 Jan Wagner + + * THANKS.in, plugins-scripts/check_oracle.sh: check_oracle: --tns bad + string matching + + check_oracle in the 1.4.15 release doesn't correctly parse the output gotten + from at least Oracle 11 (with german locales). I guess it's probably more. + Also it completely needlessly uses sed where basic bash string parsing actually + does more than suffice (and does not run into possible problems with locales + like sed ;)). + -- + Just turning attached patch of github issue #1015 into a push request. + (Closes #1015 and #1191) + 2014-07-11 Holger Weiss * NEWS: Fix typo @@ -29,8 +490,6 @@ 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 - 2014-07-07 Holger Weiss * NEWS: Add a warning regarding check_snmp @@ -93,8 +552,6 @@ * plugins/t/check_dns.t: tests: added check_dns performance data test - Signed-off-by: Sven Nierlein - 2014-02-26 abrist * plugins/check_dns.c: check_dns.c Added a bit more logic to thresholds @@ -116,8 +573,6 @@ host_specified is set. This will help the admins when multiple checks are configured - Signed-off-by: Davide Madrisan - 2014-05-19 abrist * plugins/check_nt.c: check_nt.c - Changed 'Mb' to 'MB' in MEMUSE. @@ -177,8 +632,6 @@ also make test is now working on travis-ci - Signed-off-by: Sven Nierlein - 2014-06-23 Jan Wagner * plugins/check_ide_smart.c, po/de.po, po/fr.po, @@ -329,22 +782,16 @@ when returning syscontact. So make them optional since we want to test check_snmp and not the snmpd. - Signed-off-by: Sven Nierlein - * plugins/tests/check_procs.t: tests: check_proc tests fail if uid -2 does not map to nobody so make sure our tests only run if -2 maps to nobody - Signed-off-by: Sven Nierlein - * NPTest.pm, plugins/t/check_fping.t: tests: fping checks require being root or setuid root on the fping binary. Check this before running the test. - Signed-off-by: Sven Nierlein - * plugins/tests/check_http.t: require at least HTTP::Daemon 6.01 since the test uses send_header from HTTP::Daemon::ClientConn which has been introduced in @@ -357,15 +804,11 @@ so add configurable/optional timeout to testCmd. - Signed-off-by: Sven Nierlein - * plugins/tests/check_procs.t: tests: parts of the check_procs test only work when uid -2 exists skip those tests if the uid does not exist - Signed-off-by: Sven Nierlein - 2014-06-12 Holger Weiss * configure.ac: Remove unused code @@ -409,8 +852,6 @@ See also: https:://bugs.op5.com/view.php?id=8385. - Signed-off-by: Anton Lofgren - 2014-04-03 Sam Kottler * plugins/check_apt.c: Remove the suggestion to run check_apt with @@ -446,8 +887,6 @@ * lib/Makefile.am, lib/tests/Makefile.am, plugins/Makefile.am: build - avoid deprecated INCLUDES - Signed-off-by: Davide Madrisan - 2014-02-28 Holger Weiss * plugins-scripts/check_breeze.pl, plugins-scripts/check_ircd.pl, @@ -582,8 +1021,6 @@ * plugins/check_swap.c: check_swap: Fix the plugin name that appears in the comment - Signed-off-by: Davide Madrisan - 2014-02-20 Holger Weiss * .travis.yml: travis-ci: Don't use Clang @@ -607,8 +1044,6 @@ given uid filter. So even we use sample data for this test, we still need a real user. - Signed-off-by: Sven Nierlein - 2014-02-17 Jan Wagner * plugins/check_ssh.c: check_ssh: Reverting a387120 @@ -979,8 +1414,6 @@ using an unorthodox method to remove them - Signed-off-by: Ricardo Maraschini - 2014-01-22 Lars Vogdt * plugins-scripts/check_file_age.pl, @@ -1061,8 +1494,6 @@ * perlmods/Monitoring-Plugin-0.37.tar.gz, perlmods/Nagios-Plugin-0.36.tar.gz: updated perldod with a renamed pkg - Signed-off-by: Sven Nierlein - 2014-01-20 Holger Weiss * plugins-root/check_dhcp.c, plugins-root/check_icmp.c, @@ -2531,8 +2962,6 @@ This was reported by clang, and in order for it to understand attributes properly, I had to modify the macro that checks for non-gcc compilers. - Signed-off-by: Robin Sonefors - * plugins/check_snmp.c: check_snmp: Dynamically grow all data structures Before this patch, there was a constant, MAX_OIDS, that determined the @@ -2546,8 +2975,6 @@ packetsize on the SNMP server allows, which is usually significantly smaller than infinity, yet often larger than 8. - Signed-off-by: Robin Sonefors - 2013-01-24 Daniël van Eeden * REQUIREMENTS, plugins/check_mysql.c: Apply my patch from: @@ -2601,8 +3028,6 @@ This patch allocates the proper amount of memory, to fix the issue. - Signed-off-by: Robin Sonefors - 2012-12-28 Jonathan Milby * plugins/check_mysql.c: Updated check_mysql.c to take client options @@ -2723,8 +3148,6 @@ 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 - * lib/utils_base.c: Stop dumping core on bad args to check_snmp Since the state patch introduction, we've been freeing uninitialized @@ -2742,8 +3165,6 @@ we get the memory from the kernel (which alread does that) and almost always desirable everywhere else. - Signed-off-by: Andreas Ericsson - * plugins/check_snmp.c: Make check_snmp backwards compatible in how it parses thresholds @@ -2757,8 +3178,6 @@ 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 - 2012-10-12 chl * plugins/check_disk.c: check_disk: option to ignore reserved space @@ -3019,8 +3438,6 @@ * plugins/check_smtp.c: check_smtp: Fix strcat overflows - Signed-off-by: Anders Kaseorg - * contrib/check_http-with-client-certificate.c, plugins/check_by_ssh.c, plugins/check_dig.c, plugins/check_disk.c, plugins/check_dns.c, plugins/check_fping.c, plugins/check_game.c, plugins/check_hpjd.c, @@ -3039,8 +3456,6 @@ Fixes many instances of warning: ignoring return value of 'asprintf', declared with attribute warn_unused_result [-Wunused-result] - Signed-off-by: Anders Kaseorg - * plugins/check_smtp.c: check_smtp: Strip angle brackets from -f argument, if provided @@ -3050,8 +3465,6 @@ MTAs, so let's continue to support this syntax now that we generate RFC-compliant commands. - Signed-off-by: Anders Kaseorg - 2012-06-28 Anders Kaseorg * plugins/check_smtp.c: check_smtp: Change MAIL FROM: command to comply @@ -3061,8 +3474,6 @@ 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 - 2012-06-28 Holger Weiss * package.def: Remove the package.def file @@ -4067,8 +4478,6 @@ gl/xalloc-die.c, gl/xalloc.h, gl/xmalloc.c, gl/xsize.h, gl/xstrndup.c, gl/xstrndup.h, tools/setup: Sync with the latest Gnulib code (177f525) - Signed-off-by: Thomas Guyot-Sionnest - 2010-04-13 Holger Weiss * plugins/check_ntp_peer.c: Fix typo @@ -4904,16 +5313,12 @@ when using its "-S" option on FreeBSD/amd64 (as reported and analyzed by Nikita Kalabukhov - 2797757). - Signed-off-by: Holger Weiss - * plugins-root/check_icmp.c: Don't use the plain char type for data buffers Buffers which are used for holding arbitrary data should be referenced using pointers to void and accessed using pointers to unsigned char. - Signed-off-by: Holger Weiss - 2009-06-01 Matthias Eble * plugins/check_pgsql.c: Whitespace indent fixes for check_pgsql @@ -5013,14 +5418,10 @@ gl/unistd.in.h, gl/vasnprintf.c, gl/wchar.in.h, gl/xmalloc.c: Sync with the latest Gnulib code (cb75dc5) - Signed-off-by: Holger Weiss - 2009-05-19 Chris Pepper * plugins/check_ups.c, plugins/urlize.c: Fix a few minor typos - Signed-off-by: Holger Weiss - 2009-05-19 Holger Weiss * doc/developer-guidelines.sgml: Talk about Git instead of CVS @@ -5031,8 +5432,6 @@ While at it, apply another few minor cleanups. - Signed-off-by: Holger Weiss - * doc/developer-guidelines.sgml: Remove comments regarding former requirements @@ -5041,8 +5440,6 @@ Libtool are needed for our Autotools setup. And the fact that Gettext is no longer needed probably isn't that interesting for new developers. - Signed-off-by: Holger Weiss - 2009-05-07 Ton Voon * NEWS, THANKS.in, plugins/check_disk.c: Fixed typo in check_disk @@ -14099,16 +14496,14 @@ git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@841 f882894a-f735-0410-b71e-b25c423dba1c * contrib/check_pop3.pl: fix loop and \r\n (Jason Burnett - - http://sourceforge.net/tracker/index.php?func=detail&aid=895677&group_id - =29880&atid=397599) + http://sourceforge.net/tracker/index.php?func=detail&aid=895677&group_id=29880&atid=397599) git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@840 f882894a-f735-0410-b71e-b25c423dba1c * plugins/check_disk.c: check_disk was getting blocks instead of bytes (Michael Musikhin - - http://sourceforge.net/tracker/index.php?func=detail&aid=900215&group_id - =29880&atid=397599) + http://sourceforge.net/tracker/index.php?func=detail&aid=900215&group_id=29880&atid=397599) git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@839 f882894a-f735-0410-b71e-b25c423dba1c @@ -15934,15 +16329,13 @@ 2003-06-10 Karl DeBisschop * contrib/urlize.pl: add comment about shell quote removal to address - https://sourceforge.net/tracker/index.php?func=detail&aid=661916&group_i - d=29880&atid=397597 + https://sourceforge.net/tracker/index.php?func=detail&aid=661916&group_id=29880&atid=397597 git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@544 f882894a-f735-0410-b71e-b25c423dba1c * plugins/urlize.c: add note about shell quote removal to address - https://sourceforge.net/tracker/index.php?func=detail&aid=661916&group_i - d=29880&atid=397597 + https://sourceforge.net/tracker/index.php?func=detail&aid=661916&group_id=29880&atid=397597 git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@543 f882894a-f735-0410-b71e-b25c423dba1c diff --git a/FAQ b/FAQ index 20b837c..be8e7af 100644 --- a/FAQ +++ b/FAQ @@ -29,42 +29,6 @@ A: At a minimum, the output from 'uname -a' and the version string problem and any solution/patch. -Q: I'm using Redhat Linux (or some other RPM-based distribution). - Which packages should I install? - -A: The package monitoring-plugins-..rpm contains only - those plugins that should work on any POSIX compliant system. In - other words, you should be able to install this package on your - system, no matter what else is or in not installed. - - However, most of us have more complex systems than barebones - POSIX. We tried creating a variety of separate packages so - each dependency could be installed cleanly, but many people - found that this resulted in too many packages. So in the end, - all the non-POSIX plugins were folded into one RPM - (monitoring-plugins-..rpm). Most people will need to - use RPM's '--nodeps' option to install this package. - - -Q: My system uses the .deb package format. What packages should I - install? - -A: We strive for cooperation between all packagers and developers. - The answers for .deb are the same as for RPM, after changing the - package name suffixes accordingly. - - -Q: I prefer to build my own RPMs. Do I need to install all of the - various dependencies? - -A: Beginning with the 1.2.9-1 release, you may run - - rpm --define 'custom 1' -ta monitoring-plugins-.tar.gz - - In prior releases, you must unpack the tarball and build the - RPM using monitoring-custom.spec with 'rpm -ba'. - - Q: I get an error like Warning: Return code of 127 for check of service 'PING' on host 'anyhost' was out of bounds. diff --git a/Makefile.am b/Makefile.am index 3309977..0f69e48 100644 --- a/Makefile.am +++ b/Makefile.am @@ -5,7 +5,7 @@ SUBDIRS = gl tap lib plugins plugins-scripts plugins-root po @PERLMODS_DIR@ EXTRA_DIST = config.rpath \ ABOUT-NLS ACKNOWLEDGEMENTS AUTHORS CODING ChangeLog FAQ LEGAL NEWS \ NP-VERSION-GEN REQUIREMENTS SUPPORT THANKS \ - NPTest.pm pkg monitoring-plugins.spec \ + NPTest.pm pkg \ config_test/Makefile config_test/run_tests config_test/child_test.c \ tools/build_perl_modules \ tools/tinderbox_build diff --git a/Makefile.in b/Makefile.in index c9f674f..6e96b01 100644 --- a/Makefile.in +++ b/Makefile.in @@ -52,13 +52,13 @@ host_triplet = @host@ subdir = . DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in $(srcdir)/config.h.in \ - $(srcdir)/monitoring-plugins.spec.in $(srcdir)/test.pl.in \ - $(top_srcdir)/configure $(top_srcdir)/pkg/solaris/pkginfo.in \ - ABOUT-NLS AUTHORS COPYING ChangeLog INSTALL NEWS THANKS \ - build-aux/compile build-aux/config.guess \ - build-aux/config.rpath build-aux/config.sub build-aux/depcomp \ - build-aux/install-sh build-aux/ltmain.sh build-aux/missing \ - build-aux/mkinstalldirs config.rpath mkinstalldirs + $(srcdir)/test.pl.in $(top_srcdir)/configure \ + $(top_srcdir)/pkg/solaris/pkginfo.in ABOUT-NLS AUTHORS COPYING \ + ChangeLog INSTALL NEWS THANKS build-aux/compile \ + build-aux/config.guess build-aux/config.rpath \ + build-aux/config.sub build-aux/depcomp build-aux/install-sh \ + build-aux/ltmain.sh build-aux/missing build-aux/mkinstalldirs \ + config.rpath mkinstalldirs ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/np_mysqlclient.m4 \ $(top_srcdir)/gl/m4/00gnulib.m4 $(top_srcdir)/gl/m4/alloca.m4 \ @@ -162,8 +162,7 @@ am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ configure.lineno config.status.lineno mkinstalldirs = $(SHELL) $(top_srcdir)/build-aux/mkinstalldirs CONFIG_HEADER = config.h -CONFIG_CLEAN_FILES = monitoring-plugins.spec test.pl \ - pkg/solaris/pkginfo +CONFIG_CLEAN_FILES = test.pl pkg/solaris/pkginfo CONFIG_CLEAN_VPATH_FILES = SOURCES = DIST_SOURCES = @@ -1356,7 +1355,7 @@ SUBDIRS = gl tap lib plugins plugins-scripts plugins-root po @PERLMODS_DIR@ EXTRA_DIST = config.rpath \ ABOUT-NLS ACKNOWLEDGEMENTS AUTHORS CODING ChangeLog FAQ LEGAL NEWS \ NP-VERSION-GEN REQUIREMENTS SUPPORT THANKS \ - NPTest.pm pkg monitoring-plugins.spec \ + NPTest.pm pkg \ config_test/Makefile config_test/run_tests config_test/child_test.c \ tools/build_perl_modules \ tools/tinderbox_build @@ -1420,8 +1419,6 @@ $(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) distclean-hdr: -rm -f config.h stamp-h1 -monitoring-plugins.spec: $(top_builddir)/config.status $(srcdir)/monitoring-plugins.spec.in - cd $(top_builddir) && $(SHELL) ./config.status $@ test.pl: $(top_builddir)/config.status $(srcdir)/test.pl.in cd $(top_builddir) && $(SHELL) ./config.status $@ pkg/solaris/pkginfo: $(top_builddir)/config.status $(top_srcdir)/pkg/solaris/pkginfo.in diff --git a/NEWS b/NEWS index f2898ab..16d66e3 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,33 @@ This file documents the major additions and syntax changes between releases. +2.1 15th October 2014 + ENHANCEMENTS + New check_hpjd -p option for port specification (abrist) + New ./configure --with-qmail-qstat-command option to specify the path to + qmail-qstat(8) + New check_ifstatus -n option to ignore interfaces by name + check_ntp_peer has now specific state output for each metric + New check_mysql -n option to ignore authentication failures + Added IP and port or socket name to error messages + New check_ntp_time -o option to add expected offset + check_disk shows now troubled partions in verbose mode + check_dig has now support for drill and dig + check_dig has now support for -6 option + Add performance data to check_file_age + + FIXES + Fix check_jabber to work with Openfire servers + Fix check_oracle bad string matching when testing TNS server + Fixed check_ifstatus performance data output + Fixed expire time output for sslutils + check_dns now verifies if the answer is returning from the queried + server + Fix check_by_ssh to accept --hostname as argument + + WARNINGS + This release doesn't ship with an RPM spec file, please contribute to + PR #1283 if you are interested in it + 2.0 11th July 2014 ENHANCEMENTS check_mailq now supports auto detection of qmail, postfix, exim and nullmailer with diff --git a/NP-VERSION-GEN b/NP-VERSION-GEN index 26f94e7..1878eb9 100755 --- a/NP-VERSION-GEN +++ b/NP-VERSION-GEN @@ -6,7 +6,7 @@ SRC_ROOT=`dirname $0` NPVF=NP-VERSION-FILE -DEF_VER=2.0.git +DEF_VER=2.1.git LF=' ' diff --git a/THANKS b/THANKS index 44b606f..ef6b5d8 100644 --- a/THANKS +++ b/THANKS @@ -30,6 +30,7 @@ Lutz Behnke Marlo Bell Simon Bellwood Hilko Bengen +Jason Benguerel Allan Bennett Booker C. Bense Guy Van Den Bergh @@ -112,6 +113,7 @@ Felix Frank Dann Frazier Rick Frey Matt Garrett +Jonas Genannt Robby Giffin Flo Gleixner Florian Gleixner @@ -153,6 +155,7 @@ Anders Kaseorg Jason Kau Mark Keisler Ryan Kelly +Matthew Kent Bo Kersey Konstantin Khomoutov Serhan Kiymaz @@ -160,7 +163,9 @@ Denis Knauf Tilman Koschnick John Koyle Steven Kreuzer +Julius Kriukas Christoph Kron +Frederic Krueger Marcel Kuiper Alexander Kulak Bill Kunkel @@ -196,8 +201,10 @@ Mathieu Masseboeuf Alexander Matey Ville Mattila Richard Mayhew +Patrick McAndrew Patrick McCormick Mike McHenry +Simon Meggle Stefan Meier Jan-Piet Mens Sven Meyer @@ -222,6 +229,7 @@ Craig Orsinger Vaclav Ovsik Remi Paulmier Tom Payerle +Nick Peelman Fabian Pehla Chris Pepper Matt Perry @@ -325,5 +333,7 @@ Howard Wilkinson Shawn Wills Rob Windsor Mario Witte +Alexander Wittig Brian De Wolf +Patric Wust Jamie Zawinski diff --git a/config.h.in b/config.h.in index c15000c..2aa0ff4 100644 --- a/config.h.in +++ b/config.h.in @@ -1859,9 +1859,12 @@ /* path to lmstat */ #undef PATH_TO_LMSTAT -/* path to qmail-qstat */ +/* path to mailq */ #undef PATH_TO_MAILQ +/* path to qmail-qstat */ +#undef PATH_TO_QMAIL_QSTAT + /* path to qstat/quakestat */ #undef PATH_TO_QSTAT diff --git a/configure b/configure index b224c23..c3ba8b6 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for monitoring-plugins 2.0. +# Generated by GNU Autoconf 2.69 for monitoring-plugins 2.1. # # # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. @@ -587,8 +587,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='monitoring-plugins' PACKAGE_TARNAME='monitoring-plugins' -PACKAGE_VERSION='2.0' -PACKAGE_STRING='monitoring-plugins 2.0' +PACKAGE_VERSION='2.1' +PACKAGE_STRING='monitoring-plugins 2.1' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1838,6 +1838,7 @@ with_fping_command with_fping6_command with_ssh_command with_mailq_command +with_qmail_qstat_command with_proc_meminfo with_dig_command with_apt_get_command @@ -2399,7 +2400,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures monitoring-plugins 2.0 to adapt to many kinds of systems. +\`configure' configures monitoring-plugins 2.1 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -2470,7 +2471,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of monitoring-plugins 2.0:";; + short | recursive ) echo "Configuration of monitoring-plugins 2.1:";; esac cat <<\_ACEOF @@ -2544,6 +2545,7 @@ Optional Packages: --with-fping6-command=PATH Path to fping6 command --with-ssh-command=PATH sets path for ssh --with-mailq-command=PATH sets path to mailq + --with-qmail-qstat-command=PATH sets path to qmail-qstat --with-proc-meminfo=PATH path to /proc/meminfo or equivalent --with-dig-command=PATH Path to dig command --with-apt-get-command=PATH Path to apt-get command @@ -2635,7 +2637,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -monitoring-plugins configure 2.0 +monitoring-plugins configure 2.1 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -3340,7 +3342,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by monitoring-plugins $as_me 2.0, which was +It was created by monitoring-plugins $as_me 2.1, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -3742,7 +3744,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu -ac_config_files="$ac_config_files gl/Makefile monitoring-plugins.spec" +ac_config_files="$ac_config_files gl/Makefile" ac_aux_dir= for ac_dir in build-aux "$srcdir"/build-aux; do @@ -4211,7 +4213,7 @@ fi # Define the identity of the package. PACKAGE='monitoring-plugins' - VERSION='2.0' + VERSION='2.1' cat >>confdefs.h <<_ACEOF @@ -18175,11 +18177,17 @@ $as_echo "no" >&6; } fi -if test -x "$PATH_TO_QMAIL_QSTAT" + +# Check whether --with-qmail_qstat_command was given. +if test "${with_qmail_qstat_command+set}" = set; then : + withval=$with_qmail_qstat_command; PATH_TO_QMAIL_QSTAT=$withval +fi + +if test -n "$PATH_TO_QMAIL_QSTAT" then cat >>confdefs.h <<_ACEOF -#define PATH_TO_MAILQ "$PATH_TO_QMAIL_QSTAT" +#define PATH_TO_QMAIL_QSTAT "$PATH_TO_QMAIL_QSTAT" _ACEOF else @@ -40929,7 +40937,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by monitoring-plugins $as_me 2.0, which was +This file was extended by monitoring-plugins $as_me 2.1, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -40995,7 +41003,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -monitoring-plugins config.status 2.0 +monitoring-plugins config.status 2.1 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" @@ -41409,7 +41417,6 @@ for ac_config_target in $ac_config_targets do case $ac_config_target in "gl/Makefile") CONFIG_FILES="$CONFIG_FILES gl/Makefile" ;; - "monitoring-plugins.spec") CONFIG_FILES="$CONFIG_FILES monitoring-plugins.spec" ;; "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;; diff --git a/configure.ac b/configure.ac index 9de36d3..991c1f8 100644 --- a/configure.ac +++ b/configure.ac @@ -1,9 +1,8 @@ dnl Process this file with autoconf to produce a configure script. AC_PREREQ(2.59) -AC_INIT(monitoring-plugins,2.0) +AC_INIT(monitoring-plugins,2.1) AC_CONFIG_SRCDIR(NPTest.pm) -AC_CONFIG_FILES([gl/Makefile - monitoring-plugins.spec]) +AC_CONFIG_FILES([gl/Makefile]) AC_CONFIG_AUX_DIR(build-aux) AM_INIT_AUTOMAKE([1.8.3]) AM_MAINTAINER_MODE([enable]) @@ -1478,9 +1477,12 @@ else fi AC_PATH_PROG(PATH_TO_QMAIL_QSTAT,qmail-qstat) -if test -x "$PATH_TO_QMAIL_QSTAT" +AC_ARG_WITH(qmail_qstat_command, + ACX_HELP_STRING([--with-qmail-qstat-command=PATH], + [sets path to qmail-qstat]), PATH_TO_QMAIL_QSTAT=$withval) +if test -n "$PATH_TO_QMAIL_QSTAT" then - AC_DEFINE_UNQUOTED(PATH_TO_MAILQ,"$PATH_TO_QMAIL_QSTAT",[path to qmail-qstat]) + AC_DEFINE_UNQUOTED(PATH_TO_QMAIL_QSTAT,"$PATH_TO_QMAIL_QSTAT",[path to qmail-qstat]) else AC_MSG_WARN([Could not find qmail-qstat or eqivalent]) fi diff --git a/lib/utils_base.c b/lib/utils_base.c index addf26b..3822bcf 100644 --- a/lib/utils_base.c +++ b/lib/utils_base.c @@ -446,6 +446,7 @@ void np_enable_state(char *keyname, int expected_data_version) { char *temp_filename = NULL; char *temp_keyname = NULL; char *p=NULL; + int ret; if(this_monitoring_plugin==NULL) die(STATE_UNKNOWN, _("This requires np_init to be called")); @@ -476,9 +477,13 @@ void np_enable_state(char *keyname, int expected_data_version) { this_state->state_data=NULL; /* Calculate filename */ - asprintf(&temp_filename, "%s/%lu/%s/%s", + ret = asprintf(&temp_filename, "%s/%lu/%s/%s", _np_state_calculate_location_prefix(), (unsigned long)geteuid(), this_monitoring_plugin->plugin_name, this_state->name); + if (ret < 0) + die(STATE_UNKNOWN, _("Cannot allocate memory: %s"), + strerror(errno)); + this_state->_filename=temp_filename; this_monitoring_plugin->state = this_state; @@ -614,8 +619,8 @@ void np_state_write_string(time_t data_time, char *data_string) { /* If file doesn't currently exist, create directories */ if(access(this_monitoring_plugin->state->_filename,F_OK)!=0) { - asprintf(&directories, "%s", this_monitoring_plugin->state->_filename); - if(directories==NULL) + result = asprintf(&directories, "%s", this_monitoring_plugin->state->_filename); + if(result < 0) die(STATE_UNKNOWN, _("Cannot allocate memory: %s"), strerror(errno)); @@ -633,8 +638,8 @@ void np_state_write_string(time_t data_time, char *data_string) { np_free(directories); } - asprintf(&temp_file,"%s.XXXXXX",this_monitoring_plugin->state->_filename); - if(temp_file==NULL) + result = asprintf(&temp_file,"%s.XXXXXX",this_monitoring_plugin->state->_filename); + if(result < 0) die(STATE_UNKNOWN, _("Cannot allocate memory: %s"), strerror(errno)); diff --git a/monitoring-plugins.spec b/monitoring-plugins.spec deleted file mode 100644 index da0ed63..0000000 --- a/monitoring-plugins.spec +++ /dev/null @@ -1,201 +0,0 @@ -# Macros -%define isaix %(test "`uname -s`" = "AIX" && echo "1" || echo "0") -%define islinux %(test "`uname -s`" = "Linux" && echo "1" || echo "0") -%define isredhatfamily %(test -f /etc/redhat-release && echo "1" || echo "0") - -%if %{isaix} - %define _prefix /opt/nagios -# %define _defaultdocdir %{_datadir}/doc -%else - %define _libexecdir %{_exec_prefix}/lib/nagios/plugins -%endif -%define _sysconfdir /etc/nagios - -%define npusr nagios -%define nphome /opt/nagios -%define npgrp nagios - -Name: monitoring-plugins -Version: 2.0 -Release: 1 -Summary: Host/service/network monitoring program plugins for Nagios and compatible - -Group: Applications/System -License: GPL -URL: https://www.monitoring-plugins.org/ -Source0: https://www.monitoring-plugins.org/download/%{name}-%{version}.tar.gz -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) - -%define npdir %{_builddir}/%{name}-%{version} - -%if %{isaix} -Prefix: %{_prefix} -%else -Prefix: %{_prefix}/lib/nagios/plugins -%endif -Packager: Karl DeBisschop -Vendor: Monitoring Plugins Development Team -Provides: monitoring-plugins - -%{!?custom:%global custom 0} -Obsoletes: monitoring-plugins-custom monitoring-plugins-extras - - -# Requires -%if %{isaix} -Requires: fping -Requires: gawk -Requires: net-snmp -Requires: net-snmp-perl -Requires: net-snmp-utils -Requires: openldap -Requires: openssl -Requires: perl -Requires: python -Requires: openssl -BuildRequires: fping -BuildRequires: gawk -BuildRequires: net-snmp -BuildRequires: net-snmp-perl -BuildRequires: net-snmp-utils -BuildRequires: openldap-devel -%endif -%if %{isredhatfamily} -Requires: bind-utils -Requires: coreutils -Requires: fping -Requires: gawk -Requires: grep -Requires: iputils -Requires: mysql -Requires: net-snmp-utils -Requires: ntp -Requires: openldap -Requires: openssl -Requires: openssh-clients -Requires: perl -Requires: postgresql-libs -Requires: procps -Requires: python -Requires: samba-client -Requires: shadow-utils -Requires: traceroute -Requires: /usr/bin/mailq -BuildRequires: bind-utils -BuildRequires: coreutils -BuildRequires: iputils -BuildRequires: mysql-devel -BuildRequires: net-snmp-utils -BuildRequires: net-tools -BuildRequires: ntp -BuildRequires: openldap-devel -BuildRequires: openssh-clients -BuildRequires: openssl-devel -BuildRequires: postgresql-devel -BuildRequires: procps -BuildRequires: samba-client -BuildRequires: /usr/bin/mailq -%endif - - -%description - -Nagios is a program that will monitor hosts and services on your -network, and to email or page you when a problem arises or is -resolved. Nagios runs on a unix server as a background or daemon -process, intermittently running checks on various services that you -specify. The actual service checks are performed by separate "plugin" -programs which return the status of the checks to the monitoring -system. This package contains those plugins. - - -%prep -%setup -q - - -%build -%{?isaix: MAKE=gmake} ./configure \ ---prefix=%{_prefix} \ ---exec-prefix=%{_exec_prefix} \ ---libexecdir=%{_libexecdir} \ ---sysconfdir=%{_sysconfdir} \ ---datadir=%{_datadir} \ ---with-cgiurl=/nagios/cgi-bin -ls -1 %{npdir}/plugins > %{npdir}/ls-plugins-before -ls -1 %{npdir}/plugins-root > %{npdir}/ls-plugins-root-before -ls -1 %{npdir}/plugins-scripts > %{npdir}/ls-plugins-scripts-before -make %{?_smp_mflags} -ls -1 %{npdir}/plugins > %{npdir}/ls-plugins-after -ls -1 %{npdir}/plugins-root > %{npdir}/ls-plugins-root-after -ls -1 %{npdir}/plugins-scripts > %{npdir}/ls-plugins-scripts-after - -%pre -# Create `nagios' group on the system if necessary -%if %{isaix} -lsgroup %{npgrp} > /dev/null 2> /dev/null -if [ $? -eq 2 ] ; then - mkgroup %{npgrp} || %nnmmsg Unexpected error adding group "%{npgrp}". Aborting install process. -fi -%endif -%if %{islinux} -getent group %{npgrp} > /dev/null 2> /dev/null -if [ $? -ne 0 ] ; then - groupadd %{npgrp} || %nnmmsg Unexpected error adding group "%{npgrp}". Aborting install process. -fi -%endif - -# Create `nagios' user on the system if necessary -%if %{isaix} -lsuser %{npusr} > /dev/null 2> /dev/null -if [ $? -eq 2 ] ; then - useradd -d %{nphome} -c "%{npusr}" -g %{npgrp} %{npusr} || \ - %nnmmsg Unexpected error adding user "%{npusr}". Aborting install process. -fi -%endif -%if %{islinux} -getent passwd %{npusr} > /dev/null 2> /dev/null -if [ $? -ne 0 ] ; then - useradd -r -d %{nshome} -c "%{npusr}" -g %{npgrp} %{npusr} || \ - %nnmmsg Unexpected error adding user "%{npusr}". Aborting install process. -fi -%endif - -%install -rm -rf $RPM_BUILD_ROOT -make AM_INSTALL_PROGRAM_FLAGS="" DESTDIR=${RPM_BUILD_ROOT} install -%find_lang %{name} -echo "%defattr(755,%{npusr},%{npgrp})" >> %{name}.lang -comm -13 %{npdir}/ls-plugins-before %{npdir}/ls-plugins-after | egrep -v "\.o$|^\." | gawk -v libexecdir=%{_libexecdir} '{printf( "%s/%s\n", libexecdir, $0);}' >> %{name}.lang -echo "%defattr(755,root,root)" >> %{name}.lang -comm -13 %{npdir}/ls-plugins-root-before %{npdir}/ls-plugins-root-after | egrep -v "\.o$|^\." | gawk -v libexecdir=%{_libexecdir} '{printf( "%s/%s\n", libexecdir, $0);}' >> %{name}.lang -echo "%defattr(755,%{npusr},%{npgrp})" >> %{name}.lang -comm -13 %{npdir}/ls-plugins-scripts-before %{npdir}/ls-plugins-scripts-after | egrep -v "\.o$|^\." | gawk -v libexecdir=%{_libexecdir} '{printf( "%s/%s\n", libexecdir, $0);}' >> %{name}.lang -echo "%{_libexecdir}/utils.pm" >> %{name}.lang -echo "%{_libexecdir}/utils.sh" >> %{name}.lang -echo "%{_libexecdir}/check_ldaps" >> %{name}.lang - -sed -i '/libnpcommon/d' %{name}.lang -sed -i '/monitoring-plugins.mo/d' %{name}.lang - -%clean -rm -rf $RPM_BUILD_ROOT - - -%files -f %{name}.lang -%config(missingok,noreplace) %{_sysconfdir}/command.cfg -%doc CODING COPYING FAQ INSTALL LEGAL README REQUIREMENTS SUPPORT THANKS -%doc ChangeLog command.cfg -%if ! %{isaix} -%{_datadir}/locale/de/LC_MESSAGES/monitoring-plugins.mo -%{_datadir}/locale/fr/LC_MESSAGES/monitoring-plugins.mo -%endif - -%changelog -* Mon May 23 2005 Sean Finney - cvs head -- just include the nagios plugins directory, which will automatically include - all generated plugins (which keeps the build from failing on systems that - don't have all build-dependencies for every plugin) -* Tue Mar 04 2004 Karl DeBisschop - 1.4.0alpha1 -- extensive rewrite to facilitate processing into various distro-compatible specs -* Tue Mar 04 2004 Karl DeBisschop - 1.4.0alpha1 -- extensive rewrite to facilitate processing into various distro-compatible specs diff --git a/monitoring-plugins.spec.in b/monitoring-plugins.spec.in deleted file mode 100644 index f003498..0000000 --- a/monitoring-plugins.spec.in +++ /dev/null @@ -1,201 +0,0 @@ -# Macros -%define isaix %(test "`uname -s`" = "AIX" && echo "1" || echo "0") -%define islinux %(test "`uname -s`" = "Linux" && echo "1" || echo "0") -%define isredhatfamily %(test -f /etc/redhat-release && echo "1" || echo "0") - -%if %{isaix} - %define _prefix /opt/nagios -# %define _defaultdocdir %{_datadir}/doc -%else - %define _libexecdir %{_exec_prefix}/lib/nagios/plugins -%endif -%define _sysconfdir /etc/nagios - -%define npusr nagios -%define nphome /opt/nagios -%define npgrp nagios - -Name: monitoring-plugins -Version: @PACKAGE_VERSION@ -Release: @RELEASE@ -Summary: Host/service/network monitoring program plugins for Nagios and compatible - -Group: Applications/System -License: GPL -URL: https://www.monitoring-plugins.org/ -Source0: https://www.monitoring-plugins.org/download/%{name}-%{version}.tar.gz -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) - -%define npdir %{_builddir}/%{name}-%{version} - -%if %{isaix} -Prefix: %{_prefix} -%else -Prefix: %{_prefix}/lib/nagios/plugins -%endif -Packager: Karl DeBisschop -Vendor: Monitoring Plugins Development Team -Provides: monitoring-plugins - -%{!?custom:%global custom 0} -Obsoletes: monitoring-plugins-custom monitoring-plugins-extras - - -# Requires -%if %{isaix} -Requires: fping -Requires: gawk -Requires: net-snmp -Requires: net-snmp-perl -Requires: net-snmp-utils -Requires: openldap -Requires: openssl -Requires: perl -Requires: python -Requires: openssl -BuildRequires: fping -BuildRequires: gawk -BuildRequires: net-snmp -BuildRequires: net-snmp-perl -BuildRequires: net-snmp-utils -BuildRequires: openldap-devel -%endif -%if %{isredhatfamily} -Requires: bind-utils -Requires: coreutils -Requires: fping -Requires: gawk -Requires: grep -Requires: iputils -Requires: mysql -Requires: net-snmp-utils -Requires: ntp -Requires: openldap -Requires: openssl -Requires: openssh-clients -Requires: perl -Requires: postgresql-libs -Requires: procps -Requires: python -Requires: samba-client -Requires: shadow-utils -Requires: traceroute -Requires: /usr/bin/mailq -BuildRequires: bind-utils -BuildRequires: coreutils -BuildRequires: iputils -BuildRequires: mysql-devel -BuildRequires: net-snmp-utils -BuildRequires: net-tools -BuildRequires: ntp -BuildRequires: openldap-devel -BuildRequires: openssh-clients -BuildRequires: openssl-devel -BuildRequires: postgresql-devel -BuildRequires: procps -BuildRequires: samba-client -BuildRequires: /usr/bin/mailq -%endif - - -%description - -Nagios is a program that will monitor hosts and services on your -network, and to email or page you when a problem arises or is -resolved. Nagios runs on a unix server as a background or daemon -process, intermittently running checks on various services that you -specify. The actual service checks are performed by separate "plugin" -programs which return the status of the checks to the monitoring -system. This package contains those plugins. - - -%prep -%setup -q - - -%build -%{?isaix: MAKE=gmake} ./configure \ ---prefix=%{_prefix} \ ---exec-prefix=%{_exec_prefix} \ ---libexecdir=%{_libexecdir} \ ---sysconfdir=%{_sysconfdir} \ ---datadir=%{_datadir} \ ---with-cgiurl=/nagios/cgi-bin -ls -1 %{npdir}/plugins > %{npdir}/ls-plugins-before -ls -1 %{npdir}/plugins-root > %{npdir}/ls-plugins-root-before -ls -1 %{npdir}/plugins-scripts > %{npdir}/ls-plugins-scripts-before -make %{?_smp_mflags} -ls -1 %{npdir}/plugins > %{npdir}/ls-plugins-after -ls -1 %{npdir}/plugins-root > %{npdir}/ls-plugins-root-after -ls -1 %{npdir}/plugins-scripts > %{npdir}/ls-plugins-scripts-after - -%pre -# Create `nagios' group on the system if necessary -%if %{isaix} -lsgroup %{npgrp} > /dev/null 2> /dev/null -if [ $? -eq 2 ] ; then - mkgroup %{npgrp} || %nnmmsg Unexpected error adding group "%{npgrp}". Aborting install process. -fi -%endif -%if %{islinux} -getent group %{npgrp} > /dev/null 2> /dev/null -if [ $? -ne 0 ] ; then - groupadd %{npgrp} || %nnmmsg Unexpected error adding group "%{npgrp}". Aborting install process. -fi -%endif - -# Create `nagios' user on the system if necessary -%if %{isaix} -lsuser %{npusr} > /dev/null 2> /dev/null -if [ $? -eq 2 ] ; then - useradd -d %{nphome} -c "%{npusr}" -g %{npgrp} %{npusr} || \ - %nnmmsg Unexpected error adding user "%{npusr}". Aborting install process. -fi -%endif -%if %{islinux} -getent passwd %{npusr} > /dev/null 2> /dev/null -if [ $? -ne 0 ] ; then - useradd -r -d %{nshome} -c "%{npusr}" -g %{npgrp} %{npusr} || \ - %nnmmsg Unexpected error adding user "%{npusr}". Aborting install process. -fi -%endif - -%install -rm -rf $RPM_BUILD_ROOT -make AM_INSTALL_PROGRAM_FLAGS="" DESTDIR=${RPM_BUILD_ROOT} install -%find_lang %{name} -echo "%defattr(755,%{npusr},%{npgrp})" >> %{name}.lang -comm -13 %{npdir}/ls-plugins-before %{npdir}/ls-plugins-after | egrep -v "\.o$|^\." | gawk -v libexecdir=%{_libexecdir} '{printf( "%s/%s\n", libexecdir, $0);}' >> %{name}.lang -echo "%defattr(755,root,root)" >> %{name}.lang -comm -13 %{npdir}/ls-plugins-root-before %{npdir}/ls-plugins-root-after | egrep -v "\.o$|^\." | gawk -v libexecdir=%{_libexecdir} '{printf( "%s/%s\n", libexecdir, $0);}' >> %{name}.lang -echo "%defattr(755,%{npusr},%{npgrp})" >> %{name}.lang -comm -13 %{npdir}/ls-plugins-scripts-before %{npdir}/ls-plugins-scripts-after | egrep -v "\.o$|^\." | gawk -v libexecdir=%{_libexecdir} '{printf( "%s/%s\n", libexecdir, $0);}' >> %{name}.lang -echo "%{_libexecdir}/utils.pm" >> %{name}.lang -echo "%{_libexecdir}/utils.sh" >> %{name}.lang -echo "%{_libexecdir}/check_ldaps" >> %{name}.lang - -sed -i '/libnpcommon/d' %{name}.lang -sed -i '/monitoring-plugins.mo/d' %{name}.lang - -%clean -rm -rf $RPM_BUILD_ROOT - - -%files -f %{name}.lang -%config(missingok,noreplace) %{_sysconfdir}/command.cfg -%doc CODING COPYING FAQ INSTALL LEGAL README REQUIREMENTS SUPPORT THANKS -%doc ChangeLog command.cfg -%if ! %{isaix} -%{_datadir}/locale/de/LC_MESSAGES/monitoring-plugins.mo -%{_datadir}/locale/fr/LC_MESSAGES/monitoring-plugins.mo -%endif - -%changelog -* Mon May 23 2005 Sean Finney - cvs head -- just include the nagios plugins directory, which will automatically include - all generated plugins (which keeps the build from failing on systems that - don't have all build-dependencies for every plugin) -* Tue Mar 04 2004 Karl DeBisschop - 1.4.0alpha1 -- extensive rewrite to facilitate processing into various distro-compatible specs -* Tue Mar 04 2004 Karl DeBisschop - 1.4.0alpha1 -- extensive rewrite to facilitate processing into various distro-compatible specs diff --git a/pkg/solaris/pkginfo b/pkg/solaris/pkginfo index be90d5a..4d43d8c 100644 --- a/pkg/solaris/pkginfo +++ b/pkg/solaris/pkginfo @@ -2,11 +2,11 @@ PKG="NGOSplugin" NAME="monitoring-plugins" DESC="Network Monitoring Plugins for Nagios and compatible" ARCH="unknown" -VERSION="2.0,REV=2014.07.11.17.16" +VERSION="2.1,REV=2014.10.15.14.31" CATEGORY="application" VENDOR="Monitoring Plugins Development Team" EMAIL="devel@monitoring-plugins.org" -PSTAMP="nag20140711171632" +PSTAMP="nag20141015143143" BASEDIR="/" CLASSES="none" diff --git a/plugins-scripts/check_file_age.pl b/plugins-scripts/check_file_age.pl index 453e0f5..4415fdf 100755 --- a/plugins-scripts/check_file_age.pl +++ b/plugins-scripts/check_file_age.pl @@ -34,7 +34,7 @@ sub print_help (); sub print_usage (); my ($opt_c, $opt_f, $opt_w, $opt_C, $opt_W, $opt_h, $opt_V, $opt_i); -my ($result, $message, $age, $size, $st); +my ($result, $message, $age, $size, $st, $perfdata); $PROGNAME="check_file_age"; @@ -92,6 +92,7 @@ unless (-e $opt_f) { $st = File::stat::stat($opt_f); $age = time - $st->mtime; $size = $st->size; +$perfdata = "age=${age}s;${opt_w};${opt_c} size=${size}B;${opt_W};${opt_C};0"; $result = 'OK'; @@ -103,7 +104,7 @@ elsif (($opt_w and $age > $opt_w) or ($opt_W and $size < $opt_W)) { $result = 'WARNING'; } -print "FILE_AGE $result: $opt_f is $age seconds old and $size bytes\n"; +print "FILE_AGE $result: $opt_f is $age seconds old and $size bytes | $perfdata\n"; exit $ERRORS{$result}; sub print_usage () { diff --git a/plugins-scripts/check_ifstatus.pl b/plugins-scripts/check_ifstatus.pl index fb17d98..6ec71d1 100755 --- a/plugins-scripts/check_ifstatus.pl +++ b/plugins-scripts/check_ifstatus.pl @@ -9,6 +9,7 @@ # Added -u option (4/2003) # Added -M option (10/2003) # Added SNMPv3 support (10/2003) +# Added -n option (07/2014) # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -95,8 +96,10 @@ my $ifXTable; my $opt_h ; my $opt_V ; my $opt_u; +my $opt_n; my $opt_x ; my %excluded ; +my %unused_names ; my @unused_ports ; my %session_opts; @@ -171,27 +174,30 @@ alarm(0); foreach $key (keys %ifStatus) { # skip unused interfaces - if (!defined($ifStatus{$key}{'notInUse'})) { + my $ifName = $ifStatus{$key}{$snmpIfDescr}; + + if (!defined($ifStatus{$key}{'notInUse'}) && !grep(/^${ifName}/, @unused_ports )) { # check only if interface is administratively up - if ($ifStatus{$key}{$snmpIfAdminStatus} == 1 ) { - - # check only if interface type is not listed in %excluded - if (!defined $excluded{$ifStatus{$key}{$snmpIfType}} ) { - if ($ifStatus{$key}{$snmpIfOperStatus} == 1 ) { $ifup++ ;} - if ($ifStatus{$key}{$snmpIfOperStatus} == 2 ) { - $ifdown++ ; - if (defined $ifXTable) { - $ifmessage .= sprintf("%s: down -> %s
", - $ifStatus{$key}{$snmpIfName}, - $ifStatus{$key}{$snmpIfAlias}); - }else{ - $ifmessage .= sprintf("%s: down
", - $ifStatus{$key}{$snmpIfDescr}); - } + if ($ifStatus{$key}{$snmpIfAdminStatus} == 1 ) { + #check only if interface is not excluded + if (!defined $unused_names{$ifStatus{$key}{$snmpIfDescr}} ) { + # check only if interface type is not listed in %excluded + if (!defined $excluded{$ifStatus{$key}{$snmpIfType}} ) { + if ($ifStatus{$key}{$snmpIfOperStatus} == 1 ) { $ifup++ ; } + if ($ifStatus{$key}{$snmpIfOperStatus} == 2 ) { + $ifdown++ ; + if (defined $ifXTable) { + $ifmessage .= sprintf("%s: down -> %s
\n", $ifStatus{$key}{$snmpIfName}, $ifStatus{$key}{$snmpIfAlias}); + }else{ + $ifmessage .= sprintf("%s: down
\n",$ifStatus{$key}{$snmpIfDescr}); + } + } + if ($ifStatus{$key}{$snmpIfOperStatus} == 5 ) { $ifdormant++ ;} + } else { + $ifexclude++; } - if ($ifStatus{$key}{$snmpIfOperStatus} == 5 ) { $ifdormant++ ;} - }else{ - $ifexclude++; + } else { + $ifunused++; } } @@ -221,7 +227,7 @@ foreach $key (keys %ifStatus) { $ifexclude, $ifunused); } -my $perfdata = sprintf("up=%d,down=%d,dormant=%d,excluded=%d,unused=%d",$ifup,$ifdown,$ifdormant,$ifexclude,$ifunused); +my $perfdata = sprintf("up=%d down=%d dormant=%d excluded=%d unused=%d",$ifup,$ifdown,$ifdormant,$ifexclude,$ifunused); print ("$state: $answer |$perfdata\n"); exit $ERRORS{$state}; @@ -259,6 +265,8 @@ sub print_help() { printf " the descriptive name. Do not use if you don't know what this is. \n"; printf " -x (--exclude) A comma separated list of ifType values that should be excluded \n"; printf " from the report (default for an empty list is PPP(23).\n"; + printf " -n (--unused_ports_by_name) A comma separated list of ifDescr values that should be excluded \n"; + printf " from the report (default is an empty exclusion list).\n"; printf " -u (--unused_ports) A comma separated list of ifIndex values that should be excluded \n"; printf " from the report (default is an empty exclusion list).\n"; printf " See the IANAifType-MIB for a list of interface types.\n"; @@ -299,6 +307,7 @@ sub process_arguments() { "I" => \$ifXTable, "ifmib" => \$ifXTable, "x:s" => \$opt_x, "exclude:s" => \$opt_x, "u=s" => \$opt_u, "unused_ports=s" => \$opt_u, + "n=s" => \$opt_n, "unused_ports_by_name=s" => \$opt_n, "M=i" => \$maxmsgsize, "maxmsgsize=i" => \$maxmsgsize, "t=i" => \$timeout, "timeout=i" => \$timeout, ); @@ -406,6 +415,16 @@ sub process_arguments() { } } + # Excluded interface descriptors + if (defined $opt_n) { + my @unused = split(/,/,$opt_n); + if ( @unused ) { + foreach $key (@unused) { + $unused_names{$key} = 1; + } + } + } + # Excluded interface ports (ifIndex) - management reasons if ($opt_u) { @unused_ports = split(/,/,$opt_u); diff --git a/plugins-scripts/check_log.sh b/plugins-scripts/check_log.sh index 8653a5e..d28c8d0 100755 --- a/plugins-scripts/check_log.sh +++ b/plugins-scripts/check_log.sh @@ -58,12 +58,11 @@ # Paths to commands used in this script. These # may have to be modified to match your system setup. -PROGNAME=`/bin/basename $0` +PATH="@TRUSTED_PATH@" +export PATH +PROGNAME=`basename $0` PROGPATH=`echo $0 | sed -e 's,[\\/][^\\/][^\\/]*$,,'` REVISION="@NP_VERSION@" -PATH="@TRUSTED_PATH@" - -export PATH . $PROGPATH/utils.sh diff --git a/plugins-scripts/check_mailq.pl b/plugins-scripts/check_mailq.pl index bd78981..0e8100d 100755 --- a/plugins-scripts/check_mailq.pl +++ b/plugins-scripts/check_mailq.pl @@ -332,7 +332,7 @@ elsif ( $mailq eq "postfix" ) { }elsif ($lines[0]=~/Mail queue is empty/) { $msg_q = 0; }else{ - print "Couldn't match $utils::PATH_TO_QMAIL_QSTAT output\n"; + print "Couldn't match $utils::PATH_TO_MAILQ output\n"; exit $ERRORS{'UNKNOWN'}; } @@ -340,7 +340,7 @@ elsif ( $mailq eq "postfix" ) { #if ($lines[1]=~/^messages in queue but not yet preprocessed: (\d+)/) { # my $msg_p = $1; #}else{ - # print "Couldn't match $utils::PATH_TO_QMAIL_QSTAT output\n"; + # print "Couldn't match $utils::PATH_TO_MAILQ output\n"; # exit $ERRORS{'UNKNOWN'}; #} diff --git a/plugins-scripts/check_oracle.sh b/plugins-scripts/check_oracle.sh index ceac95d..96078ac 100755 --- a/plugins-scripts/check_oracle.sh +++ b/plugins-scripts/check_oracle.sh @@ -6,10 +6,11 @@ # This Monitoring plugin was created to check Oracle status # +PATH="@TRUSTED_PATH@" +export PATH PROGNAME=`basename $0` PROGPATH=`echo $0 | sed -e 's,[\\/][^\\/][^\\/]*$,,'` REVISION="@NP_VERSION@" -PATH="@TRUSTED_PATH@" . $PROGPATH/utils.sh @@ -137,7 +138,7 @@ case "$cmd" in tnschk=` tnsping $2` tnschk2=` echo $tnschk | grep -c OK` if [ ${tnschk2} -eq 1 ] ; then - tnschk3=` echo $tnschk | sed -e 's/.*(//' -e 's/).*//'` + tnschk3=${tnschk##*(}; tnschk3=${tnschk3%)*} echo "OK - reply time ${tnschk3} from $2" exit $STATE_OK else diff --git a/plugins-scripts/check_sensors.sh b/plugins-scripts/check_sensors.sh index 05c64c4..f742830 100755 --- a/plugins-scripts/check_sensors.sh +++ b/plugins-scripts/check_sensors.sh @@ -1,11 +1,10 @@ #!/bin/sh +PATH="@TRUSTED_PATH@" +export PATH PROGNAME=`basename $0` PROGPATH=`echo $0 | sed -e 's,[\\/][^\\/][^\\/]*$,,'` REVISION="@NP_VERSION@" -PATH="@TRUSTED_PATH@" - -export PATH . $PROGPATH/utils.sh diff --git a/plugins-scripts/t/check_disk_smb.t b/plugins-scripts/t/check_disk_smb.t index 831f388..c2e8bbb 100644 --- a/plugins-scripts/t/check_disk_smb.t +++ b/plugins-scripts/t/check_disk_smb.t @@ -90,7 +90,7 @@ SKIP: { SKIP: { skip "no non responsive host defined", 1 if ( ! $host_nonresponsive ); $res = NPTest->testCmd( "./$plugin -H $host_nonresponsive -s np_foobar "); - cmp_ok( $res->return_code, '==', 3, "Exit UNKNOWN with non responsive host" ); + cmp_ok( $res->return_code, '>=', 2, "Exit CRITICAL/UNKNOWN with non responsive host" ); } } diff --git a/plugins-scripts/t/check_file_age.t b/plugins-scripts/t/check_file_age.t index a515649..50a2e69 100644 --- a/plugins-scripts/t/check_file_age.t +++ b/plugins-scripts/t/check_file_age.t @@ -5,13 +5,14 @@ # use strict; -use Test::More tests => 16; +use Test::More tests => 17; use NPTest; my $successOutput = '/^FILE_AGE OK: /'; my $warningOutput = '/^FILE_AGE WARNING: /'; my $criticalOutput = '/^FILE_AGE CRITICAL: /'; my $unknownOutput = '/^FILE_AGE UNKNOWN: /'; +my $performanceOutput = '/ \| age=[0-9]+s;[0-9]+;[0-9]+ size=[0-9]+B;[0-9]+;[0-9]+;0$/'; my $result; my $temp_file = "/tmp/check_file_age.tmp"; @@ -57,6 +58,11 @@ $result = NPTest->testCmd( ); cmp_ok( $result->return_code, '==', 0, "Checking file size" ); +$result = NPTest->testCmd( + "./check_file_age -f $temp_file -c 1000 -W 100" + ); +like( $result->output, $performanceOutput, "Checking for performance Output" ); + $result = NPTest->testCmd( "./check_file_age -f /non/existent --ignore-missing" ); diff --git a/plugins/check_by_ssh.c b/plugins/check_by_ssh.c index 58f333d..a877f88 100644 --- a/plugins/check_by_ssh.c +++ b/plugins/check_by_ssh.c @@ -169,7 +169,8 @@ process_arguments (int argc, char **argv) {"verbose", no_argument, 0, 'v'}, {"fork", no_argument, 0, 'f'}, {"timeout", required_argument, 0, 't'}, - {"host", required_argument, 0, 'H'}, + {"host", required_argument, 0, 'H'}, /* backward compatibility */ + {"hostname", required_argument, 0, 'H'}, {"port", required_argument,0,'p'}, {"output", required_argument, 0, 'O'}, {"name", required_argument, 0, 'n'}, diff --git a/plugins/check_dig.c b/plugins/check_dig.c index d9481f2..d899b11 100644 --- a/plugins/check_dig.c +++ b/plugins/check_dig.c @@ -94,8 +94,8 @@ main (int argc, char **argv) timeout_interval_dig = timeout_interval / number_tries + number_tries; /* get the command to run */ - xasprintf (&command_line, "%s @%s -p %d %s -t %s %s %s +tries=%d +time=%d", - PATH_TO_DIG, dns_server, server_port, query_address, record_type, dig_args, query_transport, number_tries, timeout_interval_dig); + xasprintf (&command_line, "%s %s %s -p %d @%s %s %s +tries=%d +time=%d", + PATH_TO_DIG, dig_args, query_transport, server_port, dns_server, query_address, record_type, number_tries, timeout_interval_dig); alarm (timeout_interval); gettimeofday (&tv, NULL); @@ -296,7 +296,10 @@ process_arguments (int argc, char **argv) dns_server = argv[c]; } else { - dns_server = strdup ("127.0.0.1"); + if (strcmp(query_transport,"-6") == 0) + dns_server = strdup("::1"); + else + dns_server = strdup ("127.0.0.1"); } } diff --git a/plugins/check_disk.c b/plugins/check_disk.c index 925dfa8..0d73a4f 100644 --- a/plugins/check_disk.c +++ b/plugins/check_disk.c @@ -171,6 +171,7 @@ main (int argc, char **argv) char *details; char *perf; char *preamble; + char *flag_header; double inode_space_pct; double warning_high_tide; double critical_high_tide; @@ -353,18 +354,23 @@ main (int argc, char **argv) if (disk_result==STATE_OK && erronly && !verbose) continue; - xasprintf (&output, "%s %s %.0f %s (%.0f%%", - output, + if(disk_result && verbose >= 1) { + xasprintf(&flag_header, " %s [", state_text (disk_result)); + } else { + xasprintf(&flag_header, ""); + } + xasprintf (&output, "%s%s %s %.0f %s (%.0f%%", + output, flag_header, (!strcmp(me->me_mountdir, "none") || display_mntp) ? me->me_devname : me->me_mountdir, path->dfree_units, units, path->dfree_pct); if (path->dused_inodes_percent < 0) { - xasprintf(&output, "%s inode=-);", output); + xasprintf(&output, "%s inode=-)%s;", output, (disk_result ? "]" : "")); } else { - xasprintf(&output, "%s inode=%.0f%%);", output, path->dfree_inodes_percent ); + xasprintf(&output, "%s inode=%.0f%%)%s;", output, path->dfree_inodes_percent, ((disk_result && verbose >= 1) ? "]" : "")); } - + free(flag_header); /* TODO: Need to do a similar debug line xasprintf (&details, _("%s\n\ %.0f of %.0f %s (%.0f%% inode=%.0f%%) free on %s (type %s mounted on %s) warn:%lu crit:%lu warn%%:%.0f%% crit%%:%.0f%%"), diff --git a/plugins/check_dns.c b/plugins/check_dns.c index 31a953d..2212122 100644 --- a/plugins/check_dns.c +++ b/plugins/check_dns.c @@ -136,6 +136,28 @@ main (int argc, char **argv) } } + /* bug ID: 2946553 - Older versions of bind will use all available dns + servers, we have to match the one specified */ + if (strstr (chld_out.line[i], "Server:") && strlen(dns_server) > 0) { + temp_buffer = strchr (chld_out.line[i], ':'); + temp_buffer++; + + /* Strip leading tabs */ + for (; *temp_buffer != '\0' && *temp_buffer == '\t'; temp_buffer++) + /* NOOP */; + + strip(temp_buffer); + if (temp_buffer==NULL || strlen(temp_buffer)==0) { + die (STATE_CRITICAL, + _("DNS CRITICAL - '%s' returned empty server string\n"), + NSLOOKUP_COMMAND); + } + + if (strcmp(temp_buffer, dns_server) != 0) { + die (STATE_CRITICAL, _("DNS CRITICAL - No response from DNS %s\n"), dns_server); + } + } + /* the server is responding, we just got the host name... */ if (strstr (chld_out.line[i], "Name:")) parse_address = TRUE; diff --git a/plugins/check_hpjd.c b/plugins/check_hpjd.c index 1e7605b..5fe0698 100644 --- a/plugins/check_hpjd.c +++ b/plugins/check_hpjd.c @@ -39,7 +39,7 @@ const char *email = "devel@monitoring-plugins.org"; #include "netutils.h" #define DEFAULT_COMMUNITY "public" - +#define DEFAULT_PORT "161" const char *option_summary = "-H host [-C community]\n"; @@ -66,6 +66,7 @@ void print_usage (void); char *community = NULL; char *address = NULL; +char *port = NULL; int main (int argc, char **argv) @@ -119,8 +120,8 @@ main (int argc, char **argv) HPJD_GD_DOOR_OPEN, HPJD_GD_PAPER_OUTPUT, HPJD_GD_STATUS_DISPLAY); /* get the command to run */ - sprintf (command_line, "%s -OQa -m : -v 1 -c %s %s %s", PATH_TO_SNMPGET, community, - address, query_string); + sprintf (command_line, "%s -OQa -m : -v 1 -c %s %s:%hd %s", PATH_TO_SNMPGET, community, + address, port, query_string); /* run the command */ child_process = spopen (command_line); @@ -313,7 +314,7 @@ process_arguments (int argc, char **argv) {"community", required_argument, 0, 'C'}, /* {"critical", required_argument,0,'c'}, */ /* {"warning", required_argument,0,'w'}, */ -/* {"port", required_argument,0,'P'}, */ + {"port", required_argument,0,'p'}, {"version", no_argument, 0, 'V'}, {"help", no_argument, 0, 'h'}, {0, 0, 0, 0} @@ -324,7 +325,7 @@ process_arguments (int argc, char **argv) while (1) { - c = getopt_long (argc, argv, "+hVH:C:", longopts, &option); + c = getopt_long (argc, argv, "+hVH:C:p:", longopts, &option); if (c == -1 || c == EOF || c == 1) break; @@ -341,6 +342,12 @@ process_arguments (int argc, char **argv) case 'C': /* community */ community = strscpy (community, optarg); break; + case 'p': + if (!is_intpos(optarg)) + usage2 (_("Port must be a positive short integer"), optarg); + else + port = atoi(optarg); + break; case 'V': /* version */ print_revision (progname, NP_VERSION); exit (STATE_OK); @@ -369,6 +376,13 @@ process_arguments (int argc, char **argv) community = strdup (DEFAULT_COMMUNITY); } + if (port == NULL) { + if (argv[c] != NULL ) + port = argv[c]; + else + port = atoi (DEFAULT_PORT); + } + return validate_arguments (); } @@ -402,6 +416,10 @@ print_help (void) printf (" %s", _("The SNMP community name ")); printf (_("(default=%s)"), DEFAULT_COMMUNITY); printf ("\n"); + printf (" %s\n", "-p, --port=STRING"); + printf (" %s", _("Specify the port to check ")); + printf (_("(default=%s)"), DEFAULT_PORT); + printf ("\n"); printf (UT_SUPPORT); } @@ -412,5 +430,5 @@ void print_usage (void) { printf ("%s\n", _("Usage:")); - printf ("%s -H host [-C community]\n", progname); + printf ("%s -H host [-C community] [-p port]\n", progname); } diff --git a/plugins/check_mysql.c b/plugins/check_mysql.c index 4f09e5f..216626b 100644 --- a/plugins/check_mysql.c +++ b/plugins/check_mysql.c @@ -42,6 +42,7 @@ const char *email = "devel@monitoring-plugins.org"; #include "netutils.h" #include +#include #include char *db_user = NULL; @@ -59,6 +60,7 @@ char *opt_file = NULL; char *opt_group = NULL; unsigned int db_port = MYSQL_PORT; int check_slave = 0, warn_sec = 0, crit_sec = 0; +int ignore_auth = 0; int verbose = 0; static double warning_time = 0; @@ -136,7 +138,16 @@ main (int argc, char **argv) mysql_ssl_set(&mysql,key,cert,ca_cert,ca_dir,ciphers); /* establish a connection to the server and error checking */ if (!mysql_real_connect(&mysql,db_host,db_user,db_pass,db,db_port,db_socket,0)) { - if (mysql_errno (&mysql) == CR_UNKNOWN_HOST) + if (ignore_auth && mysql_errno (&mysql) == ER_ACCESS_DENIED_ERROR) + { + printf("MySQL OK - Version: %s (protocol %d)\n", + mysql_get_server_info(&mysql), + mysql_get_proto_info(&mysql) + ); + mysql_close (&mysql); + return STATE_OK; + } + else if (mysql_errno (&mysql) == CR_UNKNOWN_HOST) die (STATE_WARNING, "%s\n", mysql_error (&mysql)); else if (mysql_errno (&mysql) == CR_VERSION_ERROR) die (STATE_WARNING, "%s\n", mysql_error (&mysql)); @@ -341,6 +352,7 @@ process_arguments (int argc, char **argv) {"critical", required_argument, 0, 'c'}, {"warning", required_argument, 0, 'w'}, {"check-slave", no_argument, 0, 'S'}, + {"ignore-auth", no_argument, 0, 'n'}, {"verbose", no_argument, 0, 'v'}, {"version", no_argument, 0, 'V'}, {"help", no_argument, 0, 'h'}, @@ -357,7 +369,7 @@ process_arguments (int argc, char **argv) return ERROR; while (1) { - c = getopt_long (argc, argv, "hlvVSP:p:u:d:H:s:c:w:a:k:C:D:L:f:g:", longopts, &option); + c = getopt_long (argc, argv, "hlvVnSP:p:u:d:H:s:c:w:a:k:C:D:L:f:g:", longopts, &option); if (c == -1 || c == EOF) break; @@ -419,6 +431,9 @@ process_arguments (int argc, char **argv) case 'S': check_slave = 1; /* check-slave */ break; + case 'n': + ignore_auth = 1; /* ignore-auth */ + break; case 'w': warning = optarg; warning_time = strtod (warning, NULL); @@ -506,6 +521,9 @@ print_help (void) printf (UT_EXTRA_OPTS); printf (UT_HOST_PORT, 'P', myport); + printf (" %s\n", "-n, --ignore-auth"); + printf (" %s\n", _("Ignore authentication failure and check for mysql connectivity only")); + printf (" %s\n", "-s, --socket=STRING"); printf (" %s\n", _("Use the specified socket (has no effect if -H is used)")); diff --git a/plugins/check_ntp_peer.c b/plugins/check_ntp_peer.c index 8dc1978..44424af 100644 --- a/plugins/check_ntp_peer.c +++ b/plugins/check_ntp_peer.c @@ -560,7 +560,7 @@ char *perfd_truechimers (int num_truechimers) } int main(int argc, char *argv[]){ - int result, offset_result, stratum, num_truechimers; + int result, offset_result, stratum, num_truechimers, oresult, jresult, sresult, tresult; double offset=0, jitter=0; char *result_line, *perfdata_line; @@ -597,15 +597,22 @@ int main(int argc, char *argv[]){ result = STATE_UNKNOWN; result = max_state_alt(result, get_status(fabs(offset), offset_thresholds)); } + oresult = result; + + if(do_truechimers) { + tresult = get_status(num_truechimers, truechimer_thresholds); + result = max_state_alt(result, tresult); + } - if(do_truechimers) - result = max_state_alt(result, get_status(num_truechimers, truechimer_thresholds)); + if(do_stratum) { + sresult = get_status(stratum, stratum_thresholds); + result = max_state_alt(result, sresult); + } - if(do_stratum) - result = max_state_alt(result, get_status(stratum, stratum_thresholds)); - - if(do_jitter) - result = max_state_alt(result, get_status(jitter, jitter_thresholds)); + if(do_jitter) { + jresult = get_status(jitter, jitter_thresholds); + result = max_state_alt(result, jresult); + } switch (result) { case STATE_CRITICAL : @@ -629,20 +636,43 @@ int main(int argc, char *argv[]){ if(offset_result == STATE_UNKNOWN){ xasprintf(&result_line, "%s %s", result_line, _("Offset unknown")); xasprintf(&perfdata_line, ""); + } else if (oresult == STATE_WARNING) { + xasprintf(&result_line, "%s %s %.10g secs (WARNING)", result_line, _("Offset"), offset); + } else if (oresult == STATE_CRITICAL) { + xasprintf(&result_line, "%s %s %.10g secs (CRITICAL)", result_line, _("Offset"), offset); } else { xasprintf(&result_line, "%s %s %.10g secs", result_line, _("Offset"), offset); - xasprintf(&perfdata_line, "%s", perfd_offset(offset)); - } + } + xasprintf(&perfdata_line, "%s", perfd_offset(offset)); + if (do_jitter) { - xasprintf(&result_line, "%s, jitter=%f", result_line, jitter); + if (jresult == STATE_WARNING) { + xasprintf(&result_line, "%s, jitter=%f (WARNING)", result_line, jitter); + } else if (jresult == STATE_CRITICAL) { + xasprintf(&result_line, "%s, jitter=%f (CRITICAL)", result_line, jitter); + } else { + xasprintf(&result_line, "%s, jitter=%f", result_line, jitter); + } xasprintf(&perfdata_line, "%s %s", perfdata_line, perfd_jitter(jitter)); } if (do_stratum) { - xasprintf(&result_line, "%s, stratum=%i", result_line, stratum); + if (sresult == STATE_WARNING) { + xasprintf(&result_line, "%s, stratum=%i (WARNING)", result_line, stratum); + } else if (sresult == STATE_CRITICAL) { + xasprintf(&result_line, "%s, stratum=%i (CRITICAL)", result_line, stratum); + } else { + xasprintf(&result_line, "%s, stratum=%i", result_line, stratum); + } xasprintf(&perfdata_line, "%s %s", perfdata_line, perfd_stratum(stratum)); } if (do_truechimers) { - xasprintf(&result_line, "%s, truechimers=%i", result_line, num_truechimers); + if (tresult == STATE_WARNING) { + xasprintf(&result_line, "%s, truechimers=%i (WARNING)", result_line, num_truechimers); + } else if (tresult == STATE_CRITICAL) { + xasprintf(&result_line, "%s, truechimers=%i (CRITICAL)", result_line, num_truechimers); + } else { + xasprintf(&result_line, "%s, truechimers=%i", result_line, num_truechimers); + } xasprintf(&perfdata_line, "%s %s", perfdata_line, perfd_truechimers(num_truechimers)); } printf("%s|%s\n", result_line, perfdata_line); @@ -651,8 +681,6 @@ int main(int argc, char *argv[]){ return result; } - - void print_help(void){ print_revision(progname, NP_VERSION); diff --git a/plugins/check_ntp_time.c b/plugins/check_ntp_time.c index 72dffbd..e344f8b 100644 --- a/plugins/check_ntp_time.c +++ b/plugins/check_ntp_time.c @@ -48,6 +48,7 @@ static int verbose=0; static int quiet=0; static char *owarn="60"; static char *ocrit="120"; +static int time_offset=0; int process_arguments (int, char **); thresholds *offset_thresholds = NULL; @@ -400,7 +401,7 @@ double offset_request(const char *host, int *status){ gettimeofday(&recv_time, NULL); DBG(print_ntp_message(&req[i])); respnum=servers[i].num_responses++; - servers[i].offset[respnum]=calc_offset(&req[i], &recv_time); + servers[i].offset[respnum]=calc_offset(&req[i], &recv_time)+time_offset; if(verbose) { printf("offset %.10g\n", servers[i].offset[respnum]); } @@ -455,6 +456,7 @@ int process_arguments(int argc, char **argv){ {"use-ipv4", no_argument, 0, '4'}, {"use-ipv6", no_argument, 0, '6'}, {"quiet", no_argument, 0, 'q'}, + {"time-offset", optional_argument, 0, 'o'}, {"warning", required_argument, 0, 'w'}, {"critical", required_argument, 0, 'c'}, {"timeout", required_argument, 0, 't'}, @@ -468,7 +470,7 @@ int process_arguments(int argc, char **argv){ usage ("\n"); while (1) { - c = getopt_long (argc, argv, "Vhv46qw:c:t:H:p:", longopts, &option); + c = getopt_long (argc, argv, "Vhv46qw:c:t:H:p:o:", longopts, &option); if (c == -1 || c == EOF || c == 1) break; @@ -504,6 +506,9 @@ int process_arguments(int argc, char **argv){ case 't': socket_timeout=atoi(optarg); break; + case 'o': + time_offset=atoi(optarg); + break; case '4': address_family = AF_INET; break; @@ -616,6 +621,8 @@ void print_help(void){ printf (" %s\n", _("Offset to result in warning status (seconds)")); printf (" %s\n", "-c, --critical=THRESHOLD"); printf (" %s\n", _("Offset to result in critical status (seconds)")); + printf (" %s\n", "-o, --time_offset=INTEGER"); + printf (" %s\n", _("Expected offset of the ntp server relative to local server (seconds)")); printf (UT_CONN_TIMEOUT, DEFAULT_SOCKET_TIMEOUT); printf (UT_VERBOSE); @@ -628,6 +635,8 @@ void print_help(void){ printf("%s\n", _("Notes:")); printf(" %s\n", _("If you'd rather want to monitor an NTP server, please use")); printf(" %s\n", _("check_ntp_peer.")); + printf(" %s\n", _("--time-offset is usefull for compensating for servers with known")); + printf(" %s\n", _("and expected clock skew.")); printf("\n"); printf(UT_THRESHOLDS_NOTES); @@ -642,6 +651,6 @@ void print_usage(void) { printf ("%s\n", _("Usage:")); - printf(" %s -H [-4|-6] [-w ] [-c ] [-v verbose]\n", progname); + printf(" %s -H [-4|-6] [-w ] [-c ] [-v verbose] [-o