From ae24aaeefba290d910a8d8f945716ecc84ca02ca Mon Sep 17 00:00:00 2001 From: Holger Weiss Date: Wed, 18 Jun 2014 18:45:10 +0200 Subject: Use FindBin consistently across Perl plugins Use Perl's FindBin module to locate the path to utils.pm in check_file_age.pl and check_mssql.pl, just as we do in other Perl plugins. --- plugins-scripts/check_file_age.pl | 3 ++- plugins-scripts/check_mssql.pl | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'plugins-scripts') diff --git a/plugins-scripts/check_file_age.pl b/plugins-scripts/check_file_age.pl index 5e062deb..ae25201e 100755 --- a/plugins-scripts/check_file_age.pl +++ b/plugins-scripts/check_file_age.pl @@ -25,7 +25,8 @@ use English; use Getopt::Long; use File::stat; use vars qw($PROGNAME); -use lib "."; +use FindBin; +use lib "$FindBin::Bin"; use utils qw (%ERRORS &print_revision &support); sub print_help (); diff --git a/plugins-scripts/check_mssql.pl b/plugins-scripts/check_mssql.pl index a3f497cd..a436a8ff 100755 --- a/plugins-scripts/check_mssql.pl +++ b/plugins-scripts/check_mssql.pl @@ -29,7 +29,8 @@ use DBI; use DBD::Sybase; use Getopt::Long; -use lib "."; +use FindBin; +use lib "$FindBin::Bin"; use utils qw($TIMEOUT %ERRORS &print_revision &support); use strict; -- cgit v1.2.3-74-g34f1 From 1f4fd12845a2041df3f34f7a84d8012e747e327c Mon Sep 17 00:00:00 2001 From: Holger Weiss Date: Sun, 6 Jul 2014 19:55:03 +0200 Subject: Don't rely on FindBin module to locate utils.pm As the FindBin module doesn't work with ePN, set the path to utils.pm explicitly at build time. Keep using FindBin additionally, so that the plugins can also be executed from the build directory. Closes #1271. --- plugins-scripts/Makefile.am | 3 ++- plugins-scripts/check_breeze.pl | 1 + plugins-scripts/check_disk_smb.pl | 1 + plugins-scripts/check_file_age.pl | 1 + plugins-scripts/check_flexlm.pl | 1 + plugins-scripts/check_ifoperstatus.pl | 1 + plugins-scripts/check_ifstatus.pl | 1 + plugins-scripts/check_ircd.pl | 1 + plugins-scripts/check_mailq.pl | 1 + plugins-scripts/check_mssql.pl | 1 + plugins-scripts/check_netdns.pl | 1 + plugins-scripts/check_rpc.pl | 1 + plugins-scripts/check_wave.pl | 1 + 13 files changed, 14 insertions(+), 1 deletion(-) (limited to 'plugins-scripts') diff --git a/plugins-scripts/Makefile.am b/plugins-scripts/Makefile.am index 78a950c2..794a34f8 100644 --- a/plugins-scripts/Makefile.am +++ b/plugins-scripts/Makefile.am @@ -26,7 +26,8 @@ EXTRA_DIST=check_breeze.pl check_disk_smb.pl check_flexlm.pl check_ircd.pl \ EDIT = sed \ -e 's|[@]NP_VERSION[@]|$(NP_VERSION)|g' \ -e 's|[@]TRUSTED_PATH[@]|$(with_trusted_path)|g' \ - -e 's|[@]PERL[@]|$(PERL)|g' + -e 's|[@]PERL[@]|$(PERL)|g' \ + -e 's|[@]libexecdir[@]|$(libexecdir)|g' TESTS_ENVIRONMENT=perl -I $(top_builddir) -I $(top_srcdir) diff --git a/plugins-scripts/check_breeze.pl b/plugins-scripts/check_breeze.pl index 12a60ee6..1a3aceba 100755 --- a/plugins-scripts/check_breeze.pl +++ b/plugins-scripts/check_breeze.pl @@ -6,6 +6,7 @@ use Getopt::Long; use vars qw($opt_V $opt_h $opt_w $opt_c $opt_H $opt_C $PROGNAME); use FindBin; use lib "$FindBin::Bin"; +use lib '@libexecdir@'; use utils qw(%ERRORS &print_revision &support &usage); $PROGNAME = "check_breeze"; diff --git a/plugins-scripts/check_disk_smb.pl b/plugins-scripts/check_disk_smb.pl index 99948a41..4805434f 100755 --- a/plugins-scripts/check_disk_smb.pl +++ b/plugins-scripts/check_disk_smb.pl @@ -26,6 +26,7 @@ use vars qw($opt_P $opt_V $opt_h $opt_H $opt_s $opt_W $opt_u $opt_p $opt_w $opt_ use vars qw($PROGNAME); use FindBin; use lib "$FindBin::Bin"; +use lib '@libexecdir@'; use utils qw($TIMEOUT %ERRORS &print_revision &support &usage); sub print_help (); diff --git a/plugins-scripts/check_file_age.pl b/plugins-scripts/check_file_age.pl index ae25201e..453e0f55 100755 --- a/plugins-scripts/check_file_age.pl +++ b/plugins-scripts/check_file_age.pl @@ -27,6 +27,7 @@ use File::stat; use vars qw($PROGNAME); use FindBin; use lib "$FindBin::Bin"; +use lib '@libexecdir@'; use utils qw (%ERRORS &print_revision &support); sub print_help (); diff --git a/plugins-scripts/check_flexlm.pl b/plugins-scripts/check_flexlm.pl index 49d674d4..5f3ed598 100755 --- a/plugins-scripts/check_flexlm.pl +++ b/plugins-scripts/check_flexlm.pl @@ -37,6 +37,7 @@ use Getopt::Long; use vars qw($opt_V $opt_h $opt_F $opt_t $verbose $PROGNAME); use FindBin; use lib "$FindBin::Bin"; +use lib '@libexecdir@'; use utils qw(%ERRORS &print_revision &support &usage); $PROGNAME="check_flexlm"; diff --git a/plugins-scripts/check_ifoperstatus.pl b/plugins-scripts/check_ifoperstatus.pl index 1a7fbba4..cf2c7b58 100755 --- a/plugins-scripts/check_ifoperstatus.pl +++ b/plugins-scripts/check_ifoperstatus.pl @@ -37,6 +37,7 @@ use POSIX; use strict; use FindBin; use lib "$FindBin::Bin"; +use lib '@libexecdir@'; use utils qw($TIMEOUT %ERRORS &print_revision &support); use Net::SNMP; diff --git a/plugins-scripts/check_ifstatus.pl b/plugins-scripts/check_ifstatus.pl index e9e62149..fb17d983 100755 --- a/plugins-scripts/check_ifstatus.pl +++ b/plugins-scripts/check_ifstatus.pl @@ -34,6 +34,7 @@ use POSIX; use strict; use FindBin; use lib "$FindBin::Bin"; +use lib '@libexecdir@'; use utils qw($TIMEOUT %ERRORS &print_revision &support); use Net::SNMP; diff --git a/plugins-scripts/check_ircd.pl b/plugins-scripts/check_ircd.pl index afedfb95..6d40cf5a 100755 --- a/plugins-scripts/check_ircd.pl +++ b/plugins-scripts/check_ircd.pl @@ -51,6 +51,7 @@ use vars qw($opt_V $opt_h $opt_t $opt_p $opt_H $opt_w $opt_c $verbose); use vars qw($PROGNAME); use FindBin; use lib "$FindBin::Bin"; +use lib '@libexecdir@'; use utils qw($TIMEOUT %ERRORS &print_revision &support &usage); # ----------------------------------------------------[ Function Prototypes ]-- diff --git a/plugins-scripts/check_mailq.pl b/plugins-scripts/check_mailq.pl index df1385d2..bd78981e 100755 --- a/plugins-scripts/check_mailq.pl +++ b/plugins-scripts/check_mailq.pl @@ -33,6 +33,7 @@ use vars qw($opt_V $opt_h $opt_v $verbose $PROGNAME $opt_w $opt_c $opt_t %srcdomains %dstdomains); use FindBin; use lib "$FindBin::Bin"; +use lib '@libexecdir@'; use utils qw(%ERRORS &print_revision &support &usage ); diff --git a/plugins-scripts/check_mssql.pl b/plugins-scripts/check_mssql.pl index a436a8ff..1f387884 100755 --- a/plugins-scripts/check_mssql.pl +++ b/plugins-scripts/check_mssql.pl @@ -31,6 +31,7 @@ use DBD::Sybase; use Getopt::Long; use FindBin; use lib "$FindBin::Bin"; +use lib '@libexecdir@'; use utils qw($TIMEOUT %ERRORS &print_revision &support); use strict; diff --git a/plugins-scripts/check_netdns.pl b/plugins-scripts/check_netdns.pl index 82939bff..59c81a90 100755 --- a/plugins-scripts/check_netdns.pl +++ b/plugins-scripts/check_netdns.pl @@ -29,6 +29,7 @@ use Getopt::Long; use Net::DNS; use FindBin; use lib "$FindBin::Bin"; +use lib '@libexecdir@'; use utils ; my $PROGNAME = "check_netdns"; diff --git a/plugins-scripts/check_rpc.pl b/plugins-scripts/check_rpc.pl index cbdeceb4..b1c61471 100755 --- a/plugins-scripts/check_rpc.pl +++ b/plugins-scripts/check_rpc.pl @@ -22,6 +22,7 @@ use strict; use FindBin; use lib "$FindBin::Bin"; +use lib '@libexecdir@'; use utils qw($TIMEOUT %ERRORS &print_revision &support); use vars qw($PROGNAME); my ($verbose,@proto,%prognum,$host,$response,$prognum,$port,$cmd,$progver,$state); diff --git a/plugins-scripts/check_wave.pl b/plugins-scripts/check_wave.pl index 979416e0..ee0fda4d 100755 --- a/plugins-scripts/check_wave.pl +++ b/plugins-scripts/check_wave.pl @@ -5,6 +5,7 @@ use strict; use FindBin; use lib "$FindBin::Bin"; +use lib '@libexecdir@'; use utils qw($TIMEOUT %ERRORS &print_revision &support); use vars qw($PROGNAME); use Getopt::Long; -- cgit v1.2.3-74-g34f1 From 69b719aa2e3bd8dfd643d7cbe60e6e165d5279ea Mon Sep 17 00:00:00 2001 From: Jan Wagner Date: Mon, 30 Sep 2013 17:55:22 +0200 Subject: 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. --- THANKS.in | 1 + plugins-scripts/check_ifstatus.pl | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) (limited to 'plugins-scripts') diff --git a/THANKS.in b/THANKS.in index 883387e5..43ba182f 100644 --- a/THANKS.in +++ b/THANKS.in @@ -323,3 +323,4 @@ Eric J. Mislivec Jean-Claude Computing Andy Brist Mikael Falkvidd +Patric Wust diff --git a/plugins-scripts/check_ifstatus.pl b/plugins-scripts/check_ifstatus.pl index fb17d983..709ad174 100755 --- a/plugins-scripts/check_ifstatus.pl +++ b/plugins-scripts/check_ifstatus.pl @@ -221,7 +221,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}; -- cgit v1.2.3-74-g34f1