summaryrefslogtreecommitdiffstats
path: root/plugins-scripts
diff options
context:
space:
mode:
Diffstat (limited to 'plugins-scripts')
-rwxr-xr-xplugins-scripts/check_breeze.pl1
-rwxr-xr-xplugins-scripts/check_disk_smb.pl1
-rwxr-xr-xplugins-scripts/check_file_age.pl6
-rwxr-xr-xplugins-scripts/check_flexlm.pl1
-rwxr-xr-xplugins-scripts/check_ifoperstatus.pl1
-rwxr-xr-xplugins-scripts/check_ifstatus.pl58
-rwxr-xr-xplugins-scripts/check_ircd.pl1
-rwxr-xr-xplugins-scripts/check_log.sh7
-rwxr-xr-xplugins-scripts/check_mailq.pl35
-rwxr-xr-xplugins-scripts/check_mssql.pl1
-rwxr-xr-xplugins-scripts/check_netdns.pl3
-rwxr-xr-xplugins-scripts/check_oracle.sh5
-rwxr-xr-xplugins-scripts/check_rpc.pl1
-rwxr-xr-xplugins-scripts/check_sensors.sh5
-rwxr-xr-xplugins-scripts/check_wave.pl1
-rw-r--r--plugins-scripts/t/check_disk_smb.t2
-rw-r--r--plugins-scripts/t/check_file_age.t8
-rw-r--r--plugins-scripts/utils.pm.in1
18 files changed, 83 insertions, 55 deletions
diff --git a/plugins-scripts/check_breeze.pl b/plugins-scripts/check_breeze.pl
index 1a3aceb..12a60ee 100755
--- a/plugins-scripts/check_breeze.pl
+++ b/plugins-scripts/check_breeze.pl
@@ -6,7 +6,6 @@ use Getopt::Long;
6use vars qw($opt_V $opt_h $opt_w $opt_c $opt_H $opt_C $PROGNAME); 6use vars qw($opt_V $opt_h $opt_w $opt_c $opt_H $opt_C $PROGNAME);
7use FindBin; 7use FindBin;
8use lib "$FindBin::Bin"; 8use lib "$FindBin::Bin";
9use lib '@libexecdir@';
10use utils qw(%ERRORS &print_revision &support &usage); 9use utils qw(%ERRORS &print_revision &support &usage);
11 10
12$PROGNAME = "check_breeze"; 11$PROGNAME = "check_breeze";
diff --git a/plugins-scripts/check_disk_smb.pl b/plugins-scripts/check_disk_smb.pl
index 4805434..99948a4 100755
--- a/plugins-scripts/check_disk_smb.pl
+++ b/plugins-scripts/check_disk_smb.pl
@@ -26,7 +26,6 @@ use vars qw($opt_P $opt_V $opt_h $opt_H $opt_s $opt_W $opt_u $opt_p $opt_w $opt_
26use vars qw($PROGNAME); 26use vars qw($PROGNAME);
27use FindBin; 27use FindBin;
28use lib "$FindBin::Bin"; 28use lib "$FindBin::Bin";
29use lib '@libexecdir@';
30use utils qw($TIMEOUT %ERRORS &print_revision &support &usage); 29use utils qw($TIMEOUT %ERRORS &print_revision &support &usage);
31 30
32sub print_help (); 31sub print_help ();
diff --git a/plugins-scripts/check_file_age.pl b/plugins-scripts/check_file_age.pl
index 453e0f5..15330f7 100755
--- a/plugins-scripts/check_file_age.pl
+++ b/plugins-scripts/check_file_age.pl
@@ -27,14 +27,13 @@ use File::stat;
27use vars qw($PROGNAME); 27use vars qw($PROGNAME);
28use FindBin; 28use FindBin;
29use lib "$FindBin::Bin"; 29use lib "$FindBin::Bin";
30use lib '@libexecdir@';
31use utils qw (%ERRORS &print_revision &support); 30use utils qw (%ERRORS &print_revision &support);
32 31
33sub print_help (); 32sub print_help ();
34sub print_usage (); 33sub print_usage ();
35 34
36my ($opt_c, $opt_f, $opt_w, $opt_C, $opt_W, $opt_h, $opt_V, $opt_i); 35my ($opt_c, $opt_f, $opt_w, $opt_C, $opt_W, $opt_h, $opt_V, $opt_i);
37my ($result, $message, $age, $size, $st); 36my ($result, $message, $age, $size, $st, $perfdata);
38 37
39$PROGNAME="check_file_age"; 38$PROGNAME="check_file_age";
40 39
@@ -92,6 +91,7 @@ unless (-e $opt_f) {
92$st = File::stat::stat($opt_f); 91$st = File::stat::stat($opt_f);
93$age = time - $st->mtime; 92$age = time - $st->mtime;
94$size = $st->size; 93$size = $st->size;
94$perfdata = "age=${age}s;${opt_w};${opt_c} size=${size}B;${opt_W};${opt_C};0";
95 95
96 96
97$result = 'OK'; 97$result = 'OK';
@@ -103,7 +103,7 @@ elsif (($opt_w and $age > $opt_w) or ($opt_W and $size < $opt_W)) {
103 $result = 'WARNING'; 103 $result = 'WARNING';
104} 104}
105 105
106print "FILE_AGE $result: $opt_f is $age seconds old and $size bytes\n"; 106print "FILE_AGE $result: $opt_f is $age seconds old and $size bytes | $perfdata\n";
107exit $ERRORS{$result}; 107exit $ERRORS{$result};
108 108
109sub print_usage () { 109sub print_usage () {
diff --git a/plugins-scripts/check_flexlm.pl b/plugins-scripts/check_flexlm.pl
index 5f3ed59..49d674d 100755
--- a/plugins-scripts/check_flexlm.pl
+++ b/plugins-scripts/check_flexlm.pl
@@ -37,7 +37,6 @@ use Getopt::Long;
37use vars qw($opt_V $opt_h $opt_F $opt_t $verbose $PROGNAME); 37use vars qw($opt_V $opt_h $opt_F $opt_t $verbose $PROGNAME);
38use FindBin; 38use FindBin;
39use lib "$FindBin::Bin"; 39use lib "$FindBin::Bin";
40use lib '@libexecdir@';
41use utils qw(%ERRORS &print_revision &support &usage); 40use utils qw(%ERRORS &print_revision &support &usage);
42 41
43$PROGNAME="check_flexlm"; 42$PROGNAME="check_flexlm";
diff --git a/plugins-scripts/check_ifoperstatus.pl b/plugins-scripts/check_ifoperstatus.pl
index cf2c7b5..1a7fbba 100755
--- a/plugins-scripts/check_ifoperstatus.pl
+++ b/plugins-scripts/check_ifoperstatus.pl
@@ -37,7 +37,6 @@ use POSIX;
37use strict; 37use strict;
38use FindBin; 38use FindBin;
39use lib "$FindBin::Bin"; 39use lib "$FindBin::Bin";
40use lib '@libexecdir@';
41use utils qw($TIMEOUT %ERRORS &print_revision &support); 40use utils qw($TIMEOUT %ERRORS &print_revision &support);
42 41
43use Net::SNMP; 42use Net::SNMP;
diff --git a/plugins-scripts/check_ifstatus.pl b/plugins-scripts/check_ifstatus.pl
index 709ad17..2c76d0c 100755
--- a/plugins-scripts/check_ifstatus.pl
+++ b/plugins-scripts/check_ifstatus.pl
@@ -9,6 +9,7 @@
9# Added -u option (4/2003) 9# Added -u option (4/2003)
10# Added -M option (10/2003) 10# Added -M option (10/2003)
11# Added SNMPv3 support (10/2003) 11# Added SNMPv3 support (10/2003)
12# Added -n option (07/2014)
12# 13#
13# This program is free software; you can redistribute it and/or 14# This program is free software; you can redistribute it and/or
14# modify it under the terms of the GNU General Public License 15# modify it under the terms of the GNU General Public License
@@ -34,7 +35,6 @@ use POSIX;
34use strict; 35use strict;
35use FindBin; 36use FindBin;
36use lib "$FindBin::Bin"; 37use lib "$FindBin::Bin";
37use lib '@libexecdir@';
38use utils qw($TIMEOUT %ERRORS &print_revision &support); 38use utils qw($TIMEOUT %ERRORS &print_revision &support);
39 39
40use Net::SNMP; 40use Net::SNMP;
@@ -95,8 +95,10 @@ my $ifXTable;
95my $opt_h ; 95my $opt_h ;
96my $opt_V ; 96my $opt_V ;
97my $opt_u; 97my $opt_u;
98my $opt_n;
98my $opt_x ; 99my $opt_x ;
99my %excluded ; 100my %excluded ;
101my %unused_names ;
100my @unused_ports ; 102my @unused_ports ;
101my %session_opts; 103my %session_opts;
102 104
@@ -171,27 +173,30 @@ alarm(0);
171foreach $key (keys %ifStatus) { 173foreach $key (keys %ifStatus) {
172 174
173 # skip unused interfaces 175 # skip unused interfaces
174 if (!defined($ifStatus{$key}{'notInUse'})) { 176 my $ifName = $ifStatus{$key}{$snmpIfDescr};
177
178 if (!defined($ifStatus{$key}{'notInUse'}) && !grep(/^${ifName}/, @unused_ports )) {
175 # check only if interface is administratively up 179 # check only if interface is administratively up
176 if ($ifStatus{$key}{$snmpIfAdminStatus} == 1 ) { 180 if ($ifStatus{$key}{$snmpIfAdminStatus} == 1 ) {
177 181 #check only if interface is not excluded
178 # check only if interface type is not listed in %excluded 182 if (!defined $unused_names{$ifStatus{$key}{$snmpIfDescr}} ) {
179 if (!defined $excluded{$ifStatus{$key}{$snmpIfType}} ) { 183 # check only if interface type is not listed in %excluded
180 if ($ifStatus{$key}{$snmpIfOperStatus} == 1 ) { $ifup++ ;} 184 if (!defined $excluded{$ifStatus{$key}{$snmpIfType}} ) {
181 if ($ifStatus{$key}{$snmpIfOperStatus} == 2 ) { 185 if ($ifStatus{$key}{$snmpIfOperStatus} == 1 ) { $ifup++ ; }
182 $ifdown++ ; 186 if ($ifStatus{$key}{$snmpIfOperStatus} == 2 ) {
183 if (defined $ifXTable) { 187 $ifdown++ ;
184 $ifmessage .= sprintf("%s: down -> %s<BR>", 188 if (defined $ifXTable) {
185 $ifStatus{$key}{$snmpIfName}, 189 $ifmessage .= sprintf("%s: down -> %s<BR>\n", $ifStatus{$key}{$snmpIfName}, $ifStatus{$key}{$snmpIfAlias});
186 $ifStatus{$key}{$snmpIfAlias}); 190 }else{
187 }else{ 191 $ifmessage .= sprintf("%s: down <BR>\n",$ifStatus{$key}{$snmpIfDescr});
188 $ifmessage .= sprintf("%s: down <BR>", 192 }
189 $ifStatus{$key}{$snmpIfDescr}); 193 }
190 } 194 if ($ifStatus{$key}{$snmpIfOperStatus} == 5 ) { $ifdormant++ ;}
195 } else {
196 $ifexclude++;
191 } 197 }
192 if ($ifStatus{$key}{$snmpIfOperStatus} == 5 ) { $ifdormant++ ;} 198 } else {
193 }else{ 199 $ifunused++;
194 $ifexclude++;
195 } 200 }
196 201
197 } 202 }
@@ -259,6 +264,8 @@ sub print_help() {
259 printf " the descriptive name. Do not use if you don't know what this is. \n"; 264 printf " the descriptive name. Do not use if you don't know what this is. \n";
260 printf " -x (--exclude) A comma separated list of ifType values that should be excluded \n"; 265 printf " -x (--exclude) A comma separated list of ifType values that should be excluded \n";
261 printf " from the report (default for an empty list is PPP(23).\n"; 266 printf " from the report (default for an empty list is PPP(23).\n";
267 printf " -n (--unused_ports_by_name) A comma separated list of ifDescr values that should be excluded \n";
268 printf " from the report (default is an empty exclusion list).\n";
262 printf " -u (--unused_ports) A comma separated list of ifIndex values that should be excluded \n"; 269 printf " -u (--unused_ports) A comma separated list of ifIndex values that should be excluded \n";
263 printf " from the report (default is an empty exclusion list).\n"; 270 printf " from the report (default is an empty exclusion list).\n";
264 printf " See the IANAifType-MIB for a list of interface types.\n"; 271 printf " See the IANAifType-MIB for a list of interface types.\n";
@@ -299,6 +306,7 @@ sub process_arguments() {
299 "I" => \$ifXTable, "ifmib" => \$ifXTable, 306 "I" => \$ifXTable, "ifmib" => \$ifXTable,
300 "x:s" => \$opt_x, "exclude:s" => \$opt_x, 307 "x:s" => \$opt_x, "exclude:s" => \$opt_x,
301 "u=s" => \$opt_u, "unused_ports=s" => \$opt_u, 308 "u=s" => \$opt_u, "unused_ports=s" => \$opt_u,
309 "n=s" => \$opt_n, "unused_ports_by_name=s" => \$opt_n,
302 "M=i" => \$maxmsgsize, "maxmsgsize=i" => \$maxmsgsize, 310 "M=i" => \$maxmsgsize, "maxmsgsize=i" => \$maxmsgsize,
303 "t=i" => \$timeout, "timeout=i" => \$timeout, 311 "t=i" => \$timeout, "timeout=i" => \$timeout,
304 ); 312 );
@@ -406,6 +414,16 @@ sub process_arguments() {
406 } 414 }
407 } 415 }
408 416
417 # Excluded interface descriptors
418 if (defined $opt_n) {
419 my @unused = split(/,/,$opt_n);
420 if ( @unused ) {
421 foreach $key (@unused) {
422 $unused_names{$key} = 1;
423 }
424 }
425 }
426
409 # Excluded interface ports (ifIndex) - management reasons 427 # Excluded interface ports (ifIndex) - management reasons
410 if ($opt_u) { 428 if ($opt_u) {
411 @unused_ports = split(/,/,$opt_u); 429 @unused_ports = split(/,/,$opt_u);
diff --git a/plugins-scripts/check_ircd.pl b/plugins-scripts/check_ircd.pl
index 6d40cf5..afedfb9 100755
--- a/plugins-scripts/check_ircd.pl
+++ b/plugins-scripts/check_ircd.pl
@@ -51,7 +51,6 @@ use vars qw($opt_V $opt_h $opt_t $opt_p $opt_H $opt_w $opt_c $verbose);
51use vars qw($PROGNAME); 51use vars qw($PROGNAME);
52use FindBin; 52use FindBin;
53use lib "$FindBin::Bin"; 53use lib "$FindBin::Bin";
54use lib '@libexecdir@';
55use utils qw($TIMEOUT %ERRORS &print_revision &support &usage); 54use utils qw($TIMEOUT %ERRORS &print_revision &support &usage);
56 55
57# ----------------------------------------------------[ Function Prototypes ]-- 56# ----------------------------------------------------[ Function Prototypes ]--
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 @@
58# Paths to commands used in this script. These 58# Paths to commands used in this script. These
59# may have to be modified to match your system setup. 59# may have to be modified to match your system setup.
60 60
61PROGNAME=`/bin/basename $0`
62PROGPATH=`echo $0 | sed -e 's,[\\/][^\\/][^\\/]*$,,'`
63REVISION="@NP_VERSION@"
64PATH="@TRUSTED_PATH@" 61PATH="@TRUSTED_PATH@"
65
66export PATH 62export PATH
63PROGNAME=`basename $0`
64PROGPATH=`echo $0 | sed -e 's,[\\/][^\\/][^\\/]*$,,'`
65REVISION="@NP_VERSION@"
67 66
68. $PROGPATH/utils.sh 67. $PROGPATH/utils.sh
69 68
diff --git a/plugins-scripts/check_mailq.pl b/plugins-scripts/check_mailq.pl
index bd78981..3086e94 100755
--- a/plugins-scripts/check_mailq.pl
+++ b/plugins-scripts/check_mailq.pl
@@ -28,14 +28,14 @@
28use POSIX; 28use POSIX;
29use strict; 29use strict;
30use Getopt::Long; 30use Getopt::Long;
31use vars qw($opt_V $opt_h $opt_v $verbose $PROGNAME $opt_w $opt_c $opt_t 31use vars qw($opt_V $opt_h $opt_v $verbose $PROGNAME $opt_w $opt_c $opt_t $opt_s
32 $opt_M $mailq $status $state $msg $msg_q $msg_p $opt_W $opt_C $mailq @lines 32 $opt_M $mailq $status $state $msg $msg_q $msg_p $opt_W $opt_C $mailq @lines
33 %srcdomains %dstdomains); 33 %srcdomains %dstdomains);
34use FindBin; 34use FindBin;
35use lib "$FindBin::Bin"; 35use lib "$FindBin::Bin";
36use lib '@libexecdir@';
37use utils qw(%ERRORS &print_revision &support &usage ); 36use utils qw(%ERRORS &print_revision &support &usage );
38 37
38my ($sudo);
39 39
40sub print_help (); 40sub print_help ();
41sub print_usage (); 41sub print_usage ();
@@ -57,6 +57,17 @@ if ($status){
57 exit $ERRORS{"UNKNOWN"}; 57 exit $ERRORS{"UNKNOWN"};
58} 58}
59 59
60if ($opt_s) {
61 if (defined $utils::PATH_TO_SUDO && -x $utils::PATH_TO_SUDO) {
62 $sudo = $utils::PATH_TO_SUDO;
63 } else {
64 print "ERROR: Cannot execute sudo\n";
65 exit $ERRORS{'UNKNOWN'};
66 }
67} else {
68 $sudo = "";
69}
70
60$SIG{'ALRM'} = sub { 71$SIG{'ALRM'} = sub {
61 print ("ERROR: timed out waiting for $utils::PATH_TO_MAILQ \n"); 72 print ("ERROR: timed out waiting for $utils::PATH_TO_MAILQ \n");
62 exit $ERRORS{"WARNING"}; 73 exit $ERRORS{"WARNING"};
@@ -69,7 +80,7 @@ if ($mailq eq "sendmail") {
69 80
70 ## open mailq 81 ## open mailq
71 if ( defined $utils::PATH_TO_MAILQ && -x $utils::PATH_TO_MAILQ ) { 82 if ( defined $utils::PATH_TO_MAILQ && -x $utils::PATH_TO_MAILQ ) {
72 if (! open (MAILQ, "$utils::PATH_TO_MAILQ | " ) ) { 83 if (! open (MAILQ, "$sudo $utils::PATH_TO_MAILQ | " ) ) {
73 print "ERROR: could not open $utils::PATH_TO_MAILQ \n"; 84 print "ERROR: could not open $utils::PATH_TO_MAILQ \n";
74 exit $ERRORS{'UNKNOWN'}; 85 exit $ERRORS{'UNKNOWN'};
75 } 86 }
@@ -298,7 +309,7 @@ elsif ( $mailq eq "postfix" ) {
298 309
299 ## open mailq 310 ## open mailq
300 if ( defined $utils::PATH_TO_MAILQ && -x $utils::PATH_TO_MAILQ ) { 311 if ( defined $utils::PATH_TO_MAILQ && -x $utils::PATH_TO_MAILQ ) {
301 if (! open (MAILQ, "$utils::PATH_TO_MAILQ | " ) ) { 312 if (! open (MAILQ, "$sudo $utils::PATH_TO_MAILQ | " ) ) {
302 print "ERROR: could not open $utils::PATH_TO_MAILQ \n"; 313 print "ERROR: could not open $utils::PATH_TO_MAILQ \n";
303 exit $ERRORS{'UNKNOWN'}; 314 exit $ERRORS{'UNKNOWN'};
304 } 315 }
@@ -332,7 +343,7 @@ elsif ( $mailq eq "postfix" ) {
332 }elsif ($lines[0]=~/Mail queue is empty/) { 343 }elsif ($lines[0]=~/Mail queue is empty/) {
333 $msg_q = 0; 344 $msg_q = 0;
334 }else{ 345 }else{
335 print "Couldn't match $utils::PATH_TO_QMAIL_QSTAT output\n"; 346 print "Couldn't match $utils::PATH_TO_MAILQ output\n";
336 exit $ERRORS{'UNKNOWN'}; 347 exit $ERRORS{'UNKNOWN'};
337 } 348 }
338 349
@@ -340,7 +351,7 @@ elsif ( $mailq eq "postfix" ) {
340 #if ($lines[1]=~/^messages in queue but not yet preprocessed: (\d+)/) { 351 #if ($lines[1]=~/^messages in queue but not yet preprocessed: (\d+)/) {
341 # my $msg_p = $1; 352 # my $msg_p = $1;
342 #}else{ 353 #}else{
343 # print "Couldn't match $utils::PATH_TO_QMAIL_QSTAT output\n"; 354 # print "Couldn't match $utils::PATH_TO_MAILQ output\n";
344 # exit $ERRORS{'UNKNOWN'}; 355 # exit $ERRORS{'UNKNOWN'};
345 #} 356 #}
346 357
@@ -380,7 +391,7 @@ elsif ( $mailq eq "qmail" ) {
380 391
381 # open qmail-qstat 392 # open qmail-qstat
382 if ( defined $utils::PATH_TO_QMAIL_QSTAT && -x $utils::PATH_TO_QMAIL_QSTAT ) { 393 if ( defined $utils::PATH_TO_QMAIL_QSTAT && -x $utils::PATH_TO_QMAIL_QSTAT ) {
383 if (! open (MAILQ, "$utils::PATH_TO_QMAIL_QSTAT | " ) ) { 394 if (! open (MAILQ, "$sudo $utils::PATH_TO_QMAIL_QSTAT | " ) ) {
384 print "ERROR: could not open $utils::PATH_TO_QMAIL_QSTAT \n"; 395 print "ERROR: could not open $utils::PATH_TO_QMAIL_QSTAT \n";
385 exit $ERRORS{'UNKNOWN'}; 396 exit $ERRORS{'UNKNOWN'};
386 } 397 }
@@ -462,7 +473,7 @@ elsif ( $mailq eq "qmail" ) {
462elsif ( $mailq eq "exim" ) { 473elsif ( $mailq eq "exim" ) {
463 ## open mailq 474 ## open mailq
464 if ( defined $utils::PATH_TO_MAILQ && -x $utils::PATH_TO_MAILQ ) { 475 if ( defined $utils::PATH_TO_MAILQ && -x $utils::PATH_TO_MAILQ ) {
465 if (! open (MAILQ, "$utils::PATH_TO_MAILQ | " ) ) { 476 if (! open (MAILQ, "$sudo $utils::PATH_TO_MAILQ | " ) ) {
466 print "ERROR: could not open $utils::PATH_TO_MAILQ \n"; 477 print "ERROR: could not open $utils::PATH_TO_MAILQ \n";
467 exit $ERRORS{'UNKNOWN'}; 478 exit $ERRORS{'UNKNOWN'};
468 } 479 }
@@ -505,7 +516,7 @@ elsif ( $mailq eq "exim" ) {
505elsif ( $mailq eq "nullmailer" ) { 516elsif ( $mailq eq "nullmailer" ) {
506 ## open mailq 517 ## open mailq
507 if ( defined $utils::PATH_TO_MAILQ && -x $utils::PATH_TO_MAILQ ) { 518 if ( defined $utils::PATH_TO_MAILQ && -x $utils::PATH_TO_MAILQ ) {
508 if (! open (MAILQ, "$utils::PATH_TO_MAILQ | " ) ) { 519 if (! open (MAILQ, "$sudo $utils::PATH_TO_MAILQ | " ) ) {
509 print "ERROR: could not open $utils::PATH_TO_MAILQ \n"; 520 print "ERROR: could not open $utils::PATH_TO_MAILQ \n";
510 exit $ERRORS{'UNKNOWN'}; 521 exit $ERRORS{'UNKNOWN'};
511 } 522 }
@@ -556,7 +567,8 @@ sub process_arguments(){
556 "M:s" => \$opt_M, "mailserver:s" => \$opt_M, # mailserver (default sendmail) 567 "M:s" => \$opt_M, "mailserver:s" => \$opt_M, # mailserver (default sendmail)
557 "w=i" => \$opt_w, "warning=i" => \$opt_w, # warning if above this number 568 "w=i" => \$opt_w, "warning=i" => \$opt_w, # warning if above this number
558 "c=i" => \$opt_c, "critical=i" => \$opt_c, # critical if above this number 569 "c=i" => \$opt_c, "critical=i" => \$opt_c, # critical if above this number
559 "t=i" => \$opt_t, "timeout=i" => \$opt_t 570 "t=i" => \$opt_t, "timeout=i" => \$opt_t,
571 "s" => \$opt_s, "sudo" => \$opt_s
560 ); 572 );
561 573
562 if ($opt_V) { 574 if ($opt_V) {
@@ -637,7 +649,7 @@ sub process_arguments(){
637} 649}
638 650
639sub print_usage () { 651sub print_usage () {
640 print "Usage: $PROGNAME -w <warn> -c <crit> [-W <warn>] [-C <crit>] [-M <MTA>] [-t <timeout>] [-v verbose]\n"; 652 print "Usage: $PROGNAME -w <warn> -c <crit> [-W <warn>] [-C <crit>] [-M <MTA>] [-t <timeout>] [-s] [-v]\n";
641} 653}
642 654
643sub print_help () { 655sub print_help () {
@@ -654,6 +666,7 @@ sub print_help () {
654 print "-C (--Critical) = Min. number of messages for same domain in queue to generate critical alert ( W < C )\n"; 666 print "-C (--Critical) = Min. number of messages for same domain in queue to generate critical alert ( W < C )\n";
655 print "-t (--timeout) = Plugin timeout in seconds (default = $utils::TIMEOUT)\n"; 667 print "-t (--timeout) = Plugin timeout in seconds (default = $utils::TIMEOUT)\n";
656 print "-M (--mailserver) = [ sendmail | qmail | postfix | exim | nullmailer ] (default = autodetect)\n"; 668 print "-M (--mailserver) = [ sendmail | qmail | postfix | exim | nullmailer ] (default = autodetect)\n";
669 print "-s (--sudo) = Use sudo to call the mailq command\n";
657 print "-h (--help)\n"; 670 print "-h (--help)\n";
658 print "-V (--version)\n"; 671 print "-V (--version)\n";
659 print "-v (--verbose) = debugging output\n"; 672 print "-v (--verbose) = debugging output\n";
diff --git a/plugins-scripts/check_mssql.pl b/plugins-scripts/check_mssql.pl
index 1f38788..a436a8f 100755
--- a/plugins-scripts/check_mssql.pl
+++ b/plugins-scripts/check_mssql.pl
@@ -31,7 +31,6 @@ use DBD::Sybase;
31use Getopt::Long; 31use Getopt::Long;
32use FindBin; 32use FindBin;
33use lib "$FindBin::Bin"; 33use lib "$FindBin::Bin";
34use lib '@libexecdir@';
35use utils qw($TIMEOUT %ERRORS &print_revision &support); 34use utils qw($TIMEOUT %ERRORS &print_revision &support);
36use strict; 35use strict;
37 36
diff --git a/plugins-scripts/check_netdns.pl b/plugins-scripts/check_netdns.pl
index 59c81a9..af1456b 100755
--- a/plugins-scripts/check_netdns.pl
+++ b/plugins-scripts/check_netdns.pl
@@ -29,8 +29,7 @@ use Getopt::Long;
29use Net::DNS; 29use Net::DNS;
30use FindBin; 30use FindBin;
31use lib "$FindBin::Bin"; 31use lib "$FindBin::Bin";
32use lib '@libexecdir@'; 32use utils;
33use utils ;
34 33
35my $PROGNAME = "check_netdns"; 34my $PROGNAME = "check_netdns";
36 35
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 @@
6# This Monitoring plugin was created to check Oracle status 6# This Monitoring plugin was created to check Oracle status
7# 7#
8 8
9PATH="@TRUSTED_PATH@"
10export PATH
9PROGNAME=`basename $0` 11PROGNAME=`basename $0`
10PROGPATH=`echo $0 | sed -e 's,[\\/][^\\/][^\\/]*$,,'` 12PROGPATH=`echo $0 | sed -e 's,[\\/][^\\/][^\\/]*$,,'`
11REVISION="@NP_VERSION@" 13REVISION="@NP_VERSION@"
12PATH="@TRUSTED_PATH@"
13 14
14. $PROGPATH/utils.sh 15. $PROGPATH/utils.sh
15 16
@@ -137,7 +138,7 @@ case "$cmd" in
137 tnschk=` tnsping $2` 138 tnschk=` tnsping $2`
138 tnschk2=` echo $tnschk | grep -c OK` 139 tnschk2=` echo $tnschk | grep -c OK`
139 if [ ${tnschk2} -eq 1 ] ; then 140 if [ ${tnschk2} -eq 1 ] ; then
140 tnschk3=` echo $tnschk | sed -e 's/.*(//' -e 's/).*//'` 141 tnschk3=${tnschk##*(}; tnschk3=${tnschk3%)*}
141 echo "OK - reply time ${tnschk3} from $2" 142 echo "OK - reply time ${tnschk3} from $2"
142 exit $STATE_OK 143 exit $STATE_OK
143 else 144 else
diff --git a/plugins-scripts/check_rpc.pl b/plugins-scripts/check_rpc.pl
index b1c6147..cbdeceb 100755
--- a/plugins-scripts/check_rpc.pl
+++ b/plugins-scripts/check_rpc.pl
@@ -22,7 +22,6 @@
22use strict; 22use strict;
23use FindBin; 23use FindBin;
24use lib "$FindBin::Bin"; 24use lib "$FindBin::Bin";
25use lib '@libexecdir@';
26use utils qw($TIMEOUT %ERRORS &print_revision &support); 25use utils qw($TIMEOUT %ERRORS &print_revision &support);
27use vars qw($PROGNAME); 26use vars qw($PROGNAME);
28my ($verbose,@proto,%prognum,$host,$response,$prognum,$port,$cmd,$progver,$state); 27my ($verbose,@proto,%prognum,$host,$response,$prognum,$port,$cmd,$progver,$state);
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 @@
1#!/bin/sh 1#!/bin/sh
2 2
3PATH="@TRUSTED_PATH@"
4export PATH
3PROGNAME=`basename $0` 5PROGNAME=`basename $0`
4PROGPATH=`echo $0 | sed -e 's,[\\/][^\\/][^\\/]*$,,'` 6PROGPATH=`echo $0 | sed -e 's,[\\/][^\\/][^\\/]*$,,'`
5REVISION="@NP_VERSION@" 7REVISION="@NP_VERSION@"
6PATH="@TRUSTED_PATH@"
7
8export PATH
9 8
10. $PROGPATH/utils.sh 9. $PROGPATH/utils.sh
11 10
diff --git a/plugins-scripts/check_wave.pl b/plugins-scripts/check_wave.pl
index ee0fda4..979416e 100755
--- a/plugins-scripts/check_wave.pl
+++ b/plugins-scripts/check_wave.pl
@@ -5,7 +5,6 @@
5use strict; 5use strict;
6use FindBin; 6use FindBin;
7use lib "$FindBin::Bin"; 7use lib "$FindBin::Bin";
8use lib '@libexecdir@';
9use utils qw($TIMEOUT %ERRORS &print_revision &support); 8use utils qw($TIMEOUT %ERRORS &print_revision &support);
10use vars qw($PROGNAME); 9use vars qw($PROGNAME);
11use Getopt::Long; 10use Getopt::Long;
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: {
90 SKIP: { 90 SKIP: {
91 skip "no non responsive host defined", 1 if ( ! $host_nonresponsive ); 91 skip "no non responsive host defined", 1 if ( ! $host_nonresponsive );
92 $res = NPTest->testCmd( "./$plugin -H $host_nonresponsive -s np_foobar "); 92 $res = NPTest->testCmd( "./$plugin -H $host_nonresponsive -s np_foobar ");
93 cmp_ok( $res->return_code, '==', 3, "Exit UNKNOWN with non responsive host" ); 93 cmp_ok( $res->return_code, '>=', 2, "Exit CRITICAL/UNKNOWN with non responsive host" );
94 } 94 }
95 95
96} 96}
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 @@
5# 5#
6 6
7use strict; 7use strict;
8use Test::More tests => 16; 8use Test::More tests => 17;
9use NPTest; 9use NPTest;
10 10
11my $successOutput = '/^FILE_AGE OK: /'; 11my $successOutput = '/^FILE_AGE OK: /';
12my $warningOutput = '/^FILE_AGE WARNING: /'; 12my $warningOutput = '/^FILE_AGE WARNING: /';
13my $criticalOutput = '/^FILE_AGE CRITICAL: /'; 13my $criticalOutput = '/^FILE_AGE CRITICAL: /';
14my $unknownOutput = '/^FILE_AGE UNKNOWN: /'; 14my $unknownOutput = '/^FILE_AGE UNKNOWN: /';
15my $performanceOutput = '/ \| age=[0-9]+s;[0-9]+;[0-9]+ size=[0-9]+B;[0-9]+;[0-9]+;0$/';
15 16
16my $result; 17my $result;
17my $temp_file = "/tmp/check_file_age.tmp"; 18my $temp_file = "/tmp/check_file_age.tmp";
@@ -58,6 +59,11 @@ $result = NPTest->testCmd(
58cmp_ok( $result->return_code, '==', 0, "Checking file size" ); 59cmp_ok( $result->return_code, '==', 0, "Checking file size" );
59 60
60$result = NPTest->testCmd( 61$result = NPTest->testCmd(
62 "./check_file_age -f $temp_file -c 1000 -W 100"
63 );
64like( $result->output, $performanceOutput, "Checking for performance Output" );
65
66$result = NPTest->testCmd(
61 "./check_file_age -f /non/existent --ignore-missing" 67 "./check_file_age -f /non/existent --ignore-missing"
62 ); 68 );
63cmp_ok( $result->return_code, '==', 0, "Honours --ignore-missing" ); 69cmp_ok( $result->return_code, '==', 0, "Honours --ignore-missing" );
diff --git a/plugins-scripts/utils.pm.in b/plugins-scripts/utils.pm.in
index 0f53243..386831e 100644
--- a/plugins-scripts/utils.pm.in
+++ b/plugins-scripts/utils.pm.in
@@ -17,6 +17,7 @@ sub support();
17sub is_hostname; 17sub is_hostname;
18 18
19## updated by autoconf 19## updated by autoconf
20$PATH_TO_SUDO = "@PATH_TO_SUDO@";
20$PATH_TO_RPCINFO = "@PATH_TO_RPCINFO@" ; 21$PATH_TO_RPCINFO = "@PATH_TO_RPCINFO@" ;
21$PATH_TO_LMSTAT = "@PATH_TO_LMSTAT@" ; 22$PATH_TO_LMSTAT = "@PATH_TO_LMSTAT@" ;
22$PATH_TO_SMBCLIENT = "@PATH_TO_SMBCLIENT@" ; 23$PATH_TO_SMBCLIENT = "@PATH_TO_SMBCLIENT@" ;