summaryrefslogtreecommitdiffstats
path: root/plugins-scripts
diff options
context:
space:
mode:
Diffstat (limited to 'plugins-scripts')
-rw-r--r--plugins-scripts/Makefile.am2
-rwxr-xr-xplugins-scripts/check_disk_smb.pl6
-rwxr-xr-xplugins-scripts/check_file_age.pl22
-rwxr-xr-xplugins-scripts/check_flexlm.pl4
-rwxr-xr-xplugins-scripts/check_ifoperstatus.pl13
-rwxr-xr-xplugins-scripts/check_ifstatus.pl12
-rwxr-xr-xplugins-scripts/check_ircd.pl6
-rwxr-xr-xplugins-scripts/check_log.sh29
-rwxr-xr-xplugins-scripts/check_mailq.pl47
-rwxr-xr-xplugins-scripts/check_mssql.pl4
-rwxr-xr-xplugins-scripts/check_ntp.pl471
-rwxr-xr-xplugins-scripts/check_oracle.sh2
-rwxr-xr-xplugins-scripts/check_rpc.pl4
-rw-r--r--plugins-scripts/t/check_file_age.t7
-rw-r--r--plugins-scripts/utils.pm.in4
-rw-r--r--plugins-scripts/utils.sh.in10
16 files changed, 107 insertions, 536 deletions
diff --git a/plugins-scripts/Makefile.am b/plugins-scripts/Makefile.am
index 58db060..4ea262a 100644
--- a/plugins-scripts/Makefile.am
+++ b/plugins-scripts/Makefile.am
@@ -19,7 +19,7 @@ libexec_SCRIPTS = check_breeze check_disk_smb check_flexlm check_ircd \
19 utils.sh utils.pm 19 utils.sh utils.pm
20 20
21EXTRA_DIST=check_breeze.pl check_disk_smb.pl check_flexlm.pl check_ircd.pl \ 21EXTRA_DIST=check_breeze.pl check_disk_smb.pl check_flexlm.pl check_ircd.pl \
22 check_log.sh check_ntp.pl check_oracle.sh check_rpc.pl check_sensors.sh \ 22 check_log.sh check_oracle.sh check_rpc.pl check_sensors.sh \
23 check_ifstatus.pl check_ifoperstatus.pl check_wave.pl check_mailq.pl check_file_age.pl \ 23 check_ifstatus.pl check_ifoperstatus.pl check_wave.pl check_mailq.pl check_file_age.pl \
24 utils.sh.in utils.pm.in t 24 utils.sh.in utils.pm.in t
25 25
diff --git a/plugins-scripts/check_disk_smb.pl b/plugins-scripts/check_disk_smb.pl
index 0c89db5..8b6cd2e 100755
--- a/plugins-scripts/check_disk_smb.pl
+++ b/plugins-scripts/check_disk_smb.pl
@@ -3,7 +3,7 @@
3# 3#
4# check_disk.pl <host> <share> <user> <pass> [warn] [critical] [port] 4# check_disk.pl <host> <share> <user> <pass> [warn] [critical] [port]
5# 5#
6# Nagios host script to get the disk usage from a SMB share 6# Monitoring host script to get the disk usage from a SMB share
7# 7#
8# Changes and Modifications 8# Changes and Modifications
9# ========================= 9# =========================
@@ -171,7 +171,7 @@ my $res = undef;
171my $perfdata = ""; 171my $perfdata = "";
172my @lines = undef; 172my @lines = undef;
173 173
174# Just in case of problems, let's not hang Nagios 174# Just in case of problems, let's not hang the monitoring system
175$SIG{'ALRM'} = sub { 175$SIG{'ALRM'} = sub {
176 print "No Answer from Client\n"; 176 print "No Answer from Client\n";
177 exit $ERRORS{"UNKNOWN"}; 177 exit $ERRORS{"UNKNOWN"};
@@ -293,7 +293,7 @@ sub print_help () {
293 print_revision($PROGNAME,'@NP_VERSION@'); 293 print_revision($PROGNAME,'@NP_VERSION@');
294 print "Copyright (c) 2000 Michael Anthon/Karl DeBisschop 294 print "Copyright (c) 2000 Michael Anthon/Karl DeBisschop
295 295
296Perl Check SMB Disk plugin for Nagios 296Perl Check SMB Disk plugin for monitoring
297 297
298"; 298";
299 print_usage(); 299 print_usage();
diff --git a/plugins-scripts/check_file_age.pl b/plugins-scripts/check_file_age.pl
index dcd5efa..2781c2a 100755
--- a/plugins-scripts/check_file_age.pl
+++ b/plugins-scripts/check_file_age.pl
@@ -17,9 +17,8 @@
17# GNU General Public License for more details. 17# GNU General Public License for more details.
18# 18#
19# you should have received a copy of the GNU General Public License 19# you should have received a copy of the GNU General Public License
20# along with this program (or with Nagios); if not, write to the 20# along with this program if not, write to the Free Software Foundation,
21# Free Software Foundation, Inc., 59 Temple Place - Suite 330, 21# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
22# Boston, MA 02111-1307, USA
23 22
24use strict; 23use strict;
25use English; 24use English;
@@ -32,7 +31,7 @@ use utils qw (%ERRORS &print_revision &support);
32sub print_help (); 31sub print_help ();
33sub print_usage (); 32sub print_usage ();
34 33
35my ($opt_c, $opt_f, $opt_w, $opt_C, $opt_W, $opt_h, $opt_V); 34my ($opt_c, $opt_f, $opt_w, $opt_C, $opt_W, $opt_h, $opt_V, $opt_i);
36my ($result, $message, $age, $size, $st); 35my ($result, $message, $age, $size, $st);
37 36
38$PROGNAME="check_file_age"; 37$PROGNAME="check_file_age";
@@ -47,6 +46,7 @@ Getopt::Long::Configure('bundling');
47GetOptions( 46GetOptions(
48 "V" => \$opt_V, "version" => \$opt_V, 47 "V" => \$opt_V, "version" => \$opt_V,
49 "h" => \$opt_h, "help" => \$opt_h, 48 "h" => \$opt_h, "help" => \$opt_h,
49 "i" => \$opt_i, "ignore-missing" => \$opt_i,
50 "f=s" => \$opt_f, "file" => \$opt_f, 50 "f=s" => \$opt_f, "file" => \$opt_f,
51 "w=f" => \$opt_w, "warning-age=f" => \$opt_w, 51 "w=f" => \$opt_w, "warning-age=f" => \$opt_w,
52 "W=f" => \$opt_W, "warning-size=f" => \$opt_W, 52 "W=f" => \$opt_W, "warning-size=f" => \$opt_W,
@@ -72,8 +72,15 @@ if (! $opt_f) {
72 72
73# Check that file exists (can be directory or link) 73# Check that file exists (can be directory or link)
74unless (-e $opt_f) { 74unless (-e $opt_f) {
75 print "FILE_AGE CRITICAL: File not found - $opt_f\n"; 75 if ($opt_i) {
76 exit $ERRORS{'CRITICAL'}; 76 $result = 'OK';
77 print "FILE_AGE $result: $opt_f doesn't exist, but ignore-missing was set\n";
78 exit $ERRORS{$result};
79
80 } else {
81 print "FILE_AGE CRITICAL: File not found - $opt_f\n";
82 exit $ERRORS{'CRITICAL'};
83 }
77} 84}
78 85
79$st = File::stat::stat($opt_f); 86$st = File::stat::stat($opt_f);
@@ -95,7 +102,7 @@ exit $ERRORS{$result};
95 102
96sub print_usage () { 103sub print_usage () {
97 print "Usage:\n"; 104 print "Usage:\n";
98 print " $PROGNAME [-w <secs>] [-c <secs>] [-W <size>] [-C <size>] -f <file>\n"; 105 print " $PROGNAME [-w <secs>] [-c <secs>] [-W <size>] [-C <size>] [-i] -f <file>\n";
99 print " $PROGNAME [-h | --help]\n"; 106 print " $PROGNAME [-h | --help]\n";
100 print " $PROGNAME [-V | --version]\n"; 107 print " $PROGNAME [-V | --version]\n";
101} 108}
@@ -105,6 +112,7 @@ sub print_help () {
105 print "Copyright (c) 2003 Steven Grimm\n\n"; 112 print "Copyright (c) 2003 Steven Grimm\n\n";
106 print_usage(); 113 print_usage();
107 print "\n"; 114 print "\n";
115 print " -i | --ignore-missing : return OK if the file does not exist\n";
108 print " <secs> File must be no more than this many seconds old (default: warn 240 secs, crit 600)\n"; 116 print " <secs> File must be no more than this many seconds old (default: warn 240 secs, crit 600)\n";
109 print " <size> File must be at least this many bytes long (default: crit 0 bytes)\n"; 117 print " <size> File must be at least this many bytes long (default: crit 0 bytes)\n";
110 print "\n"; 118 print "\n";
diff --git a/plugins-scripts/check_flexlm.pl b/plugins-scripts/check_flexlm.pl
index 54d933c..574c1cc 100755
--- a/plugins-scripts/check_flexlm.pl
+++ b/plugins-scripts/check_flexlm.pl
@@ -9,7 +9,7 @@
9# Check and interpret the output of lmstat 9# Check and interpret the output of lmstat
10# and create returncodes and output. 10# and create returncodes and output.
11# 11#
12# Contrary to the nagios concept, this script takes 12# Contrary to most other plugins, this script takes
13# a file, not a hostname as an argument and returns 13# a file, not a hostname as an argument and returns
14# the status of hosts and services described in that 14# the status of hosts and services described in that
15# file. Use these hosts.cfg entries as an example 15# file. Use these hosts.cfg entries as an example
@@ -72,7 +72,7 @@ unless (defined $opt_F) {
72 print_usage(); 72 print_usage();
73 exit $ERRORS{'UNKNOWN'}; 73 exit $ERRORS{'UNKNOWN'};
74} 74}
75# Just in case of problems, let's not hang Nagios 75# Just in case of problems, let's not hang the monitoring system
76$SIG{'ALRM'} = sub { 76$SIG{'ALRM'} = sub {
77 print "Timeout: No Answer from Client\n"; 77 print "Timeout: No Answer from Client\n";
78 exit $ERRORS{'UNKNOWN'}; 78 exit $ERRORS{'UNKNOWN'};
diff --git a/plugins-scripts/check_ifoperstatus.pl b/plugins-scripts/check_ifoperstatus.pl
index 43e09eb..a431cf3 100755
--- a/plugins-scripts/check_ifoperstatus.pl
+++ b/plugins-scripts/check_ifoperstatus.pl
@@ -1,9 +1,9 @@
1#!/usr/local/bin/perl -w 1#!/usr/local/bin/perl -w
2# 2#
3# check_ifoperstatus.pl - nagios plugin 3# check_ifoperstatus.pl - monitoring plugin
4# 4#
5# Copyright (C) 2000 Christoph Kron, 5# Copyright (C) 2000 Christoph Kron,
6# Modified 5/2002 to conform to updated Nagios Plugin Guidelines 6# Modified 5/2002 to conform to updated Monitoring Plugins Guidelines
7# Added support for named interfaces per Valdimir Ivaschenko (S. Ghosh) 7# Added support for named interfaces per Valdimir Ivaschenko (S. Ghosh)
8# Added SNMPv3 support (10/2003) 8# Added SNMPv3 support (10/2003)
9# 9#
@@ -19,10 +19,11 @@
19# 19#
20# You should have received a copy of the GNU General Public License 20# You should have received a copy of the GNU General Public License
21# along with this program; if not, write to the Free Software 21# along with this program; if not, write to the Free Software
22# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 22# Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
23# USA
23# 24#
24# 25#
25# Report bugs to: help@nagios-plugins.org 26# Report bugs to: help@monitoring-plugins.org
26# 27#
27# 11.01.2000 Version 1.0 28# 11.01.2000 Version 1.0
28# 29#
@@ -97,7 +98,7 @@ my %session_opts;
97$status = process_arguments(); 98$status = process_arguments();
98 99
99 100
100# Just in case of problems, let's not hang Nagios 101# Just in case of problems, let's not hang the monitoring system
101$SIG{'ALRM'} = sub { 102$SIG{'ALRM'} = sub {
102 print ("ERROR: No snmp response from $hostname (alarm)\n"); 103 print ("ERROR: No snmp response from $hostname (alarm)\n");
103 exit $ERRORS{"UNKNOWN"}; 104 exit $ERRORS{"UNKNOWN"};
@@ -288,7 +289,7 @@ sub print_usage() {
288sub print_help() { 289sub print_help() {
289 print_revision($PROGNAME, '@NP_VERSION@'); 290 print_revision($PROGNAME, '@NP_VERSION@');
290 print_usage(); 291 print_usage();
291 printf "check_ifoperstatus plugin for Nagios monitors operational \n"; 292 printf "check_ifoperstatus plugin for monitoring operational \n";
292 printf "status of a particular network interface on the target host\n"; 293 printf "status of a particular network interface on the target host\n";
293 printf "\nUsage:\n"; 294 printf "\nUsage:\n";
294 printf " -H (--hostname) Hostname to query - (required)\n"; 295 printf " -H (--hostname) Hostname to query - (required)\n";
diff --git a/plugins-scripts/check_ifstatus.pl b/plugins-scripts/check_ifstatus.pl
index 63c71ff..b8faada 100755
--- a/plugins-scripts/check_ifstatus.pl
+++ b/plugins-scripts/check_ifstatus.pl
@@ -1,10 +1,10 @@
1#!/usr/local/bin/perl -w 1#!/usr/local/bin/perl -w
2# 2#
3# check_ifstatus.pl - nagios plugin 3# check_ifstatus.pl - monitoring plugin
4# 4#
5# 5#
6# Copyright (C) 2000 Christoph Kron 6# Copyright (C) 2000 Christoph Kron
7# Modified 5/2002 to conform to updated Nagios Plugin Guidelines (S. Ghosh) 7# Modified 5/2002 to conform to updated Monitoring Plugins Guidelines (S. Ghosh)
8# Added -x option (4/2003) 8# Added -x option (4/2003)
9# Added -u option (4/2003) 9# Added -u option (4/2003)
10# Added -M option (10/2003) 10# Added -M option (10/2003)
@@ -22,10 +22,10 @@
22# 22#
23# You should have received a copy of the GNU General Public License 23# You should have received a copy of the GNU General Public License
24# along with this program; if not, write to the Free Software 24# along with this program; if not, write to the Free Software
25# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 25# Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
26# 26#
27# 27#
28# Report bugs to: ck@zet.net, nagiosplug-help@lists.sf.net 28# Report bugs to: ck@zet.net, help@monitoring-plugins.org
29# 29#
30# 11.01.2000 Version 1.0 30# 11.01.2000 Version 1.0
31# 31#
@@ -99,7 +99,7 @@ my %session_opts;
99 99
100 100
101 101
102# Just in case of problems, let's not hang Nagios 102# Just in case of problems, let's not hang the monitoring system
103$SIG{'ALRM'} = sub { 103$SIG{'ALRM'} = sub {
104 print ("ERROR: No snmp response from $hostname (alarm timeout)\n"); 104 print ("ERROR: No snmp response from $hostname (alarm timeout)\n");
105 exit $ERRORS{"UNKNOWN"}; 105 exit $ERRORS{"UNKNOWN"};
@@ -239,7 +239,7 @@ sub print_usage() {
239sub print_help() { 239sub print_help() {
240 print_revision($PROGNAME, '@NP_VERSION@'); 240 print_revision($PROGNAME, '@NP_VERSION@');
241 print_usage(); 241 print_usage();
242 printf "check_ifstatus plugin for Nagios monitors operational \n"; 242 printf "check_ifstatus plugin for monitoring operational \n";
243 printf "status of each network interface on the target host\n"; 243 printf "status of each network interface on the target host\n";
244 printf "\nUsage:\n"; 244 printf "\nUsage:\n";
245 printf " -H (--hostname) Hostname to query - (required)\n"; 245 printf " -H (--hostname) Hostname to query - (required)\n";
diff --git a/plugins-scripts/check_ircd.pl b/plugins-scripts/check_ircd.pl
index 42a9bca..7612a0e 100755
--- a/plugins-scripts/check_ircd.pl
+++ b/plugins-scripts/check_ircd.pl
@@ -16,8 +16,6 @@
16# ----------------------------------------------------------------------------- 16# -----------------------------------------------------------------------------
17# Copyright 1999 (c) Richard Mayhew 17# Copyright 1999 (c) Richard Mayhew
18# 18#
19# Credits go to Ethan Galstad for coding Nagios
20#
21# If any changes are made to this script, please mail me a copy of the 19# If any changes are made to this script, please mail me a copy of the
22# changes :) 20# changes :)
23# 21#
@@ -121,7 +119,7 @@ sub print_help ()
121 print_revision($PROGNAME,'@NP_VERSION@'); 119 print_revision($PROGNAME,'@NP_VERSION@');
122 print "Copyright (c) 2000 Richard Mayhew/Karl DeBisschop 120 print "Copyright (c) 2000 Richard Mayhew/Karl DeBisschop
123 121
124Perl Check IRCD plugin for Nagios 122Perl Check IRCD plugin for monitoring
125 123
126"; 124";
127 print_usage(); 125 print_usage();
@@ -205,7 +203,7 @@ MAIN:
205 203
206 if ($opt_t && $opt_t =~ /^([0-9]+)$/) { $TIMEOUT = $1; } 204 if ($opt_t && $opt_t =~ /^([0-9]+)$/) { $TIMEOUT = $1; }
207 205
208 # Just in case of problems, let's not hang Nagios 206 # Just in case of problems, let's not hang the monitoring system
209 $SIG{'ALRM'} = sub { 207 $SIG{'ALRM'} = sub {
210 print "Somthing is Taking a Long Time, Increase Your TIMEOUT (Currently Set At $TIMEOUT Seconds)\n"; 208 print "Somthing is Taking a Long Time, Increase Your TIMEOUT (Currently Set At $TIMEOUT Seconds)\n";
211 exit $ERRORS{"UNKNOWN"}; 209 exit $ERRORS{"UNKNOWN"};
diff --git a/plugins-scripts/check_log.sh b/plugins-scripts/check_log.sh
index a1bfb48..54408cb 100755
--- a/plugins-scripts/check_log.sh
+++ b/plugins-scripts/check_log.sh
@@ -1,6 +1,6 @@
1#!/bin/sh 1#!/bin/sh
2# 2#
3# Log file pattern detector plugin for Nagios 3# Log file pattern detector plugin for monitoring
4# Written by Ethan Galstad (nagios@nagios.org) 4# Written by Ethan Galstad (nagios@nagios.org)
5# Last Modified: 07-31-1999 5# Last Modified: 07-31-1999
6# 6#
@@ -29,15 +29,15 @@
29# 29#
30# If you use this plugin make sure to keep the following in mind: 30# If you use this plugin make sure to keep the following in mind:
31# 31#
32# 1. The "max_attempts" value for the service should be 1, as this 32# 1. The "max_attempts" value for the service should be 1, as this will
33# will prevent Nagios from retrying the service check (the 33# prevent the monitoring system from retrying the service check (the
34# next time the check is run it will not produce the same results). 34# next time the check is run it will not produce the same results).
35# 35#
36# 2. The "notify_recovery" value for the service should be 0, so that 36# 2. The "notify_recovery" value for the service should be 0, so that the
37# Nagios does not notify you of "recoveries" for the check. Since 37# monitoring system does not notify you of "recoveries" for the check.
38# pattern matches in the log file will only be reported once and not 38# Since pattern matches in the log file will only be reported once and
39# the next time, there will always be "recoveries" for the service, even 39# not the next time, there will always be "recoveries" for the service,
40# though recoveries really don't apply to this type of check. 40# even though recoveries really don't apply to this type of check.
41# 41#
42# 3. You *must* supply a different <old_file_log> for each service that 42# 3. You *must* supply a different <old_file_log> for each service that
43# you define to use this plugin script - even if the different services 43# you define to use this plugin script - even if the different services
@@ -60,7 +60,6 @@
60# TV: removed PATH restriction. Need to think more about what this means overall 60# TV: removed PATH restriction. Need to think more about what this means overall
61#PATH="" 61#PATH=""
62 62
63ECHO="/bin/echo"
64GREP="/bin/egrep" 63GREP="/bin/egrep"
65DIFF="/bin/diff" 64DIFF="/bin/diff"
66TAIL="/bin/tail" 65TAIL="/bin/tail"
@@ -86,7 +85,7 @@ print_help() {
86 echo "" 85 echo ""
87 print_usage 86 print_usage
88 echo "" 87 echo ""
89 echo "Log file pattern detector plugin for Nagios" 88 echo "Log file pattern detector plugin for monitoring"
90 echo "" 89 echo ""
91 support 90 support
92} 91}
@@ -167,10 +166,10 @@ done
167# If the source log file doesn't exist, exit 166# If the source log file doesn't exist, exit
168 167
169if [ ! -e $logfile ]; then 168if [ ! -e $logfile ]; then
170 $ECHO "Log check error: Log file $logfile does not exist!\n" 169 echo "Log check error: Log file $logfile does not exist!"
171 exit $STATE_UNKNOWN 170 exit $STATE_UNKNOWN
172elif [ ! -r $logfile ] ; then 171elif [ ! -r $logfile ] ; then
173 $ECHO "Log check error: Log file $logfile is not readable!\n" 172 echo "Log check error: Log file $logfile is not readable!"
174 exit $STATE_UNKNOWN 173 exit $STATE_UNKNOWN
175fi 174fi
176 175
@@ -180,7 +179,7 @@ fi
180 179
181if [ ! -e $oldlog ]; then 180if [ ! -e $oldlog ]; then
182 $CAT $logfile > $oldlog 181 $CAT $logfile > $oldlog
183 $ECHO "Log check data initialized...\n" 182 echo "Log check data initialized..."
184 exit $STATE_OK 183 exit $STATE_OK
185fi 184fi
186 185
@@ -209,10 +208,10 @@ $RM -f $tempdiff
209$CAT $logfile > $oldlog 208$CAT $logfile > $oldlog
210 209
211if [ "$count" = "0" ]; then # no matches, exit with no error 210if [ "$count" = "0" ]; then # no matches, exit with no error
212 $ECHO "Log check ok - 0 pattern matches found\n" 211 echo "Log check ok - 0 pattern matches found"
213 exitstatus=$STATE_OK 212 exitstatus=$STATE_OK
214else # Print total matche count and the last entry we found 213else # Print total matche count and the last entry we found
215 $ECHO "($count) $lastentry" 214 echo "($count) $lastentry"
216 exitstatus=$STATE_CRITICAL 215 exitstatus=$STATE_CRITICAL
217fi 216fi
218 217
diff --git a/plugins-scripts/check_mailq.pl b/plugins-scripts/check_mailq.pl
index 31eb46a..2a805b6 100755
--- a/plugins-scripts/check_mailq.pl
+++ b/plugins-scripts/check_mailq.pl
@@ -20,8 +20,8 @@
20# 20#
21# You should have received a copy of the GNU General Public License 21# You should have received a copy of the GNU General Public License
22# along with this program; if not, write to the Free Software 22# along with this program; if not, write to the Free Software
23# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 23# Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
24# 24# USA
25# 25#
26############################################################################ 26############################################################################
27 27
@@ -373,7 +373,7 @@ elsif ( $mailq eq "postfix" ) {
373 # } 373 # }
374 #} 374 #}
375 } 375 }
376} # end of ($mailq eq "postfixl") 376} # end of ($mailq eq "postfix")
377elsif ( $mailq eq "qmail" ) { 377elsif ( $mailq eq "qmail" ) {
378 378
379 # open qmail-qstat 379 # open qmail-qstat
@@ -500,6 +500,43 @@ elsif ( $mailq eq "exim" ) {
500 } 500 }
501} # end of ($mailq eq "exim") 501} # end of ($mailq eq "exim")
502 502
503elsif ( $mailq eq "nullmailer" ) {
504 ## open mailq
505 if ( defined $utils::PATH_TO_MAILQ && -x $utils::PATH_TO_MAILQ ) {
506 if (! open (MAILQ, "$utils::PATH_TO_MAILQ | " ) ) {
507 print "ERROR: could not open $utils::PATH_TO_MAILQ \n";
508 exit $ERRORS{'UNKNOWN'};
509 }
510 }elsif( defined $utils::PATH_TO_MAILQ){
511 unless (-x $utils::PATH_TO_MAILQ) {
512 print "ERROR: $utils::PATH_TO_MAILQ is not executable by (uid $>:gid($)))\n";
513 exit $ERRORS{'UNKNOWN'};
514 }
515 } else {
516 print "ERROR: \$utils::PATH_TO_MAILQ is not defined\n";
517 exit $ERRORS{'UNKNOWN'};
518 }
519
520 while (<MAILQ>) {
521 #2006-06-22 16:00:00 282 bytes
522
523 if (/^[1-9][0-9]*-[01][0-9]-[0-3][0-9]\s[0-2][0-9]\:[0-2][0-9]\:[0-2][0-9]\s{2}[0-9]+\sbytes$/) {
524 $msg_q++ ;
525 }
526 }
527 close(MAILQ) ;
528 if ($msg_q < $opt_w) {
529 $msg = "OK: mailq ($msg_q) is below threshold ($opt_w/$opt_c)";
530 $state = $ERRORS{'OK'};
531 }elsif ($msg_q >= $opt_w && $msg_q < $opt_c) {
532 $msg = "WARNING: mailq is $msg_q (threshold w = $opt_w)";
533 $state = $ERRORS{'WARNING'};
534 }else {
535 $msg = "CRITICAL: mailq is $msg_q (threshold c = $opt_c)";
536 $state = $ERRORS{'CRITICAL'};
537 }
538} # end of ($mailq eq "nullmailer")
539
503# Perfdata support 540# Perfdata support
504print "$msg|unsent=$msg_q;$opt_w;$opt_c;0\n"; 541print "$msg|unsent=$msg_q;$opt_w;$opt_c;0\n";
505exit $state; 542exit $state;
@@ -559,7 +596,7 @@ sub process_arguments(){
559 } 596 }
560 597
561 if (defined $opt_M) { 598 if (defined $opt_M) {
562 if ($opt_M =~ /^(sendmail|qmail|postfix|exim)$/) { 599 if ($opt_M =~ /^(sendmail|qmail|postfix|exim|nullmailer)$/) {
563 $mailq = $opt_M ; 600 $mailq = $opt_M ;
564 }elsif( $opt_M eq ''){ 601 }elsif( $opt_M eq ''){
565 $mailq = 'sendmail'; 602 $mailq = 'sendmail';
@@ -591,7 +628,7 @@ sub print_help () {
591 print "-W (--Warning) = Min. number of messages for same domain in queue to generate warning\n"; 628 print "-W (--Warning) = Min. number of messages for same domain in queue to generate warning\n";
592 print "-C (--Critical) = Min. number of messages for same domain in queue to generate critical alert ( W < C )\n"; 629 print "-C (--Critical) = Min. number of messages for same domain in queue to generate critical alert ( W < C )\n";
593 print "-t (--timeout) = Plugin timeout in seconds (default = $utils::TIMEOUT)\n"; 630 print "-t (--timeout) = Plugin timeout in seconds (default = $utils::TIMEOUT)\n";
594 print "-M (--mailserver) = [ sendmail | qmail | postfix | exim ] (default = sendmail)\n"; 631 print "-M (--mailserver) = [ sendmail | qmail | postfix | exim | nullmailer ] (default = sendmail)\n";
595 print "-h (--help)\n"; 632 print "-h (--help)\n";
596 print "-V (--version)\n"; 633 print "-V (--version)\n";
597 print "-v (--verbose) = debugging output\n"; 634 print "-v (--verbose) = debugging output\n";
diff --git a/plugins-scripts/check_mssql.pl b/plugins-scripts/check_mssql.pl
index cbf2ae7..e3e7391 100755
--- a/plugins-scripts/check_mssql.pl
+++ b/plugins-scripts/check_mssql.pl
@@ -21,7 +21,7 @@
21# along with this program; if not, write to the Free Software 21# along with this program; if not, write to the Free Software
22# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 22# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23# 23#
24# Report bugs to: help@nagios-plugins.org 24# Report bugs to: help@monitoring-plugins.org
25# 25#
26# 26#
27 27
@@ -44,7 +44,7 @@ my $exitcode = $ERRORS{'OK'};
44 44
45process_arguments(); 45process_arguments();
46 46
47# Just in case of problems, let's not hang Nagios 47# Just in case of problems, let's not hang the monitoring system
48$SIG{'ALRM'} = sub { 48$SIG{'ALRM'} = sub {
49 print ("SQL UNKNOWN: ERROR connection $server (alarm timeout)\n"); 49 print ("SQL UNKNOWN: ERROR connection $server (alarm timeout)\n");
50 exit $ERRORS{"UNKNOWN"}; 50 exit $ERRORS{"UNKNOWN"};
diff --git a/plugins-scripts/check_ntp.pl b/plugins-scripts/check_ntp.pl
deleted file mode 100755
index 5c87e0a..0000000
--- a/plugins-scripts/check_ntp.pl
+++ /dev/null
@@ -1,471 +0,0 @@
1#!/usr/bin/perl -w
2#
3# (c)1999 Ian Cass, Knowledge Matters Ltd.
4# Read the GNU copyright stuff for all the legalese
5#
6# Check NTP time servers plugin. This plugin requires the ntpdate utility to
7# be installed on the system, however since it's part of the ntp suite, you
8# should already have it installed.
9#
10#
11# Nothing clever done in this program - its a very simple bare basics hack to
12# get the job done.
13#
14# Things to do...
15# check @words[9] for time differences greater than +/- x secs & return a
16# warning.
17#
18# (c) 1999 Mark Jewiss, Knowledge Matters Limited
19# 22-9-1999, 12:45
20#
21# Modified script to accept 2 parameters or set defaults.
22# Now issues warning or critical alert is time difference is greater than the
23# time passed.
24#
25# These changes have not been tested completely due to the unavailability of a
26# server with the incorrect time.
27#
28# (c) 1999 Bo Kersey, VirCIO - Managed Server Solutions <bo@vircio.com>
29# 22-10-99, 12:17
30#
31# Modified the script to give useage if no parameters are input.
32#
33# Modified the script to check for negative as well as positive
34# time differences.
35#
36# Modified the script to work with ntpdate 3-5.93e Wed Apr 14 20:23:03 EDT 1999
37#
38# Modified the script to work with ntpdate's that return adjust or offset...
39#
40#
41# Script modified 2000 June 01 by William Pietri <william@bianca.com>
42#
43# Modified script to handle weird cases:
44# o NTP server doesn't respond (e.g., has died)
45# o Server has correct time but isn't suitable synchronization
46# source. This happens while starting up and if contact
47# with master has been lost.
48#
49# Modifed to run under Embedded Perl (sghosh@users.sf.net)
50# - combined logic some blocks together..
51#
52# Added ntpdate check for stratum 16 desynch peer (James Fidell) Feb 03, 2003
53#
54# ntpdate - offset is in seconds
55# changed ntpdc to ntpq - jitter/dispersion is in milliseconds
56#
57# Patch for for regex for stratum1 refid.
58
59require 5.004;
60use POSIX;
61use strict;
62use Getopt::Long;
63use vars qw($opt_V $opt_h $opt_H $opt_t $opt_w $opt_c $opt_O $opt_j $opt_k $verbose $PROGNAME $def_jitter $ipv4 $ipv6);
64use lib utils.pm;
65use utils qw($TIMEOUT %ERRORS &print_revision &support);
66
67$PROGNAME="check_ntp";
68
69sub print_help ();
70sub print_usage ();
71
72$ENV{'PATH'}='';
73$ENV{'BASH_ENV'}='';
74$ENV{'ENV'}='';
75
76# defaults in sec
77my $DEFAULT_OFFSET_WARN = 60; # 1 minute
78my $DEFAULT_OFFSET_CRIT = 120; # 2 minutes
79# default in millisec
80my $DEFAULT_JITTER_WARN = 5000; # 5 sec
81my $DEFAULT_JITTER_CRIT = 10000; # 10 sec
82
83Getopt::Long::Configure('bundling');
84GetOptions
85 ("V" => \$opt_V, "version" => \$opt_V,
86 "h" => \$opt_h, "help" => \$opt_h,
87 "v" => \$verbose, "verbose" => \$verbose,
88 "4" => \$ipv4, "use-ipv4" => \$ipv4,
89 "6" => \$ipv6, "use-ipv6" => \$ipv6,
90 "w=f" => \$opt_w, "warning=f" => \$opt_w, # offset|adjust warning if above this number
91 "c=f" => \$opt_c, "critical=f" => \$opt_c, # offset|adjust critical if above this number
92 "O" => \$opt_O, "zero-offset" => \$opt_O, # zero-offset bad
93 "j=s" => \$opt_j, "jwarn=i" => \$opt_j, # jitter warning if above this number
94 "k=s" => \$opt_k, "jcrit=i" => \$opt_k, # jitter critical if above this number
95 "t=s" => \$opt_t, "timeout=i" => \$opt_t,
96 "H=s" => \$opt_H, "hostname=s" => \$opt_H);
97
98if ($opt_V) {
99 print_revision($PROGNAME,'@NP_VERSION@');
100 exit $ERRORS{'OK'};
101}
102
103if ($opt_h) {
104 print_help();
105 exit $ERRORS{'OK'};
106}
107
108# jitter test params specified
109if (defined $opt_j || defined $opt_k ) {
110 $def_jitter = 1;
111}
112
113$opt_H = shift unless ($opt_H);
114my $host = $1 if ($opt_H && $opt_H =~ m/^([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+|[a-zA-Z][-a-zA-Z0-9]+(\.[a-zA-Z][-a-zA-Z0-9]+)*)$/);
115unless ($host) {
116 print "No target host specified\n";
117 print_usage();
118 exit $ERRORS{'UNKNOWN'};
119}
120
121my ($timeout, $owarn, $ocrit, $jwarn, $jcrit);
122
123$timeout = $TIMEOUT;
124($opt_t) && ($opt_t =~ /^([0-9]+)$/) && ($timeout = $1);
125
126$owarn = $DEFAULT_OFFSET_WARN;
127($opt_w) && ($opt_w =~ /^([0-9.]+)$/) && ($owarn = $1);
128
129$ocrit = $DEFAULT_OFFSET_CRIT;
130($opt_c) && ($opt_c =~ /^([0-9.]+)$/) && ($ocrit = $1);
131
132$jwarn = $DEFAULT_JITTER_WARN;
133($opt_j) && ($opt_j =~ /^([0-9]+)$/) && ($jwarn = $1);
134
135$jcrit = $DEFAULT_JITTER_CRIT;
136($opt_k) && ($opt_k =~ /^([0-9]+)$/) && ($jcrit = $1);
137
138if ($ocrit < $owarn ) {
139 print "Critical offset should be larger than warning offset\n";
140 print_usage();
141 exit $ERRORS{"UNKNOWN"};
142}
143
144if ($def_jitter) {
145 if ($opt_k < $opt_j) {
146 print "Critical jitter should be larger than warning jitter\n";
147 print_usage();
148 exit $ERRORS{'UNKNOWN'};
149 }
150}
151
152
153my $stratum = -1;
154my $ignoreret = 0;
155my $answer = undef;
156my $offset = undef;
157my $jitter = undef;
158my $syspeer = undef;
159my $candidate = 0;
160my @candidates;
161my $msg; # first line of output to print if format is invalid
162
163my $state = $ERRORS{'UNKNOWN'};
164my $ntpdate_error = $ERRORS{'UNKNOWN'};
165my $jitter_error = $ERRORS{'UNKNOWN'};
166
167# some systems don't have a proper ntpq (migrated from ntpdc)
168my $have_ntpq = undef;
169if ($utils::PATH_TO_NTPQ && -x $utils::PATH_TO_NTPQ ) {
170 $have_ntpq = 1;
171}else{
172 $have_ntpq = 0;
173}
174
175# Just in case of problems, let's not hang Nagios
176$SIG{'ALRM'} = sub {
177 print ("ERROR: No response from ntp server (alarm)\n");
178 exit $ERRORS{"UNKNOWN"};
179};
180alarm($timeout);
181
182# Determine protocol to be used for ntpdate and ntpq
183my $ntpdate = $utils::PATH_TO_NTPDATE;
184my $ntpq = $utils::PATH_TO_NTPQ;
185if ($ipv4) {
186 $ntpdate .= " -4";
187 $ntpq .= " -4";
188}
189elsif ($ipv6) {
190 $ntpdate .= " -6";
191 $ntpq .= " -6";
192}
193# else don't use any flags
194
195###
196###
197### First, check ntpdate
198###
199###
200
201if (!open (NTPDATE, $ntpdate . " -q $host 2>&1 |")) {
202 print "Could not open $ntpdate: $!\n";
203 exit $ERRORS{"UNKNOWN"};
204}
205
206my $out;
207while (<NTPDATE>) {
208 #print if ($verbose); # noop
209 $msg = $_ unless ($msg);
210 $out .= "$_ ";
211
212 if (/stratum\s(\d+)/) {
213 $stratum = $1;
214 }
215
216 if (/(offset|adjust)\s+([-.\d]+)/i) {
217 $offset = $2;
218
219 # An offset of 0.000000 with an error is probably bogus. Actually,
220 # it's probably always bogus, but let's be paranoid here.
221 # Has been reported that 0.0000 happens in a production environment
222 # on Solaris 8 so this check should be taken out - SF tracker 1150777
223 if (defined $opt_O ) {
224 if ($offset == 0) { undef $offset;}
225 }
226
227 $ntpdate_error = defined ($offset) ? $ERRORS{"OK"} : $ERRORS{"CRITICAL"};
228 print "ntperr = $ntpdate_error \n" if $verbose;
229
230 }
231
232 if (/no server suitable for synchronization found/) {
233 if ($stratum == 16) {
234 $ntpdate_error = $ERRORS{"WARNING"};
235 $msg = "Desynchronized peer server found";
236 $ignoreret=1;
237 }
238 else {
239 $ntpdate_error = $ERRORS{"CRITICAL"};
240 $msg = "No suitable peer server found - ";
241 }
242 }
243
244}
245$out =~ s/\n//g;
246close (NTPDATE) ||
247 die $! ? "$out - Error closing $ntpdate pipe: $!"
248 : "$out - Exit status: $? from $ntpdate\n";
249
250# declare an error if we also get a non-zero return code from ntpdate
251# unless already set to critical
252if ( $? && !$ignoreret ) {
253 print "stderr = $? : $! \n" if $verbose;
254 $ntpdate_error = $ntpdate_error == $ERRORS{"CRITICAL"} ? $ERRORS{"CRITICAL"} : $ERRORS{"UNKNOWN"} ;
255 print "ntperr = $ntpdate_error : $!\n" if $verbose;
256}
257
258###
259###
260### Then scan xntpq/ntpq if it exists
261### and look in the 11th column for jitter
262###
263# Field 1: Tally Code ( Space, 'x','.','-','+','#','*','o')
264# Only match for '*' which implies sys.peer
265# or 'o' which implies pps.peer
266# If both exist, the last one is picked.
267# Field 2: address of the remote peer
268# Field 3: Refid of the clock (0.0.0.0 if unknown, WWWV/PPS/GPS/ACTS/USNO/PCS/... if Stratum1)
269# Field 4: stratum (0-15)
270# Field 5: Type of the peer: local (l), unicast (u), multicast (m)
271# broadcast (b); not sure about multicast/broadcast
272# Field 6: last packet receive (in seconds)
273# Field 7: polling interval
274# Field 8: reachability resgister (octal)
275# Field 9: delay
276# Field 10: offset
277# Field 11: dispersion/jitter
278#
279# According to bug 773588 Some solaris xntpd implementations seemto match on
280# "#" even though the docs say it exceeds maximum distance. Providing patch
281# here which will generate a warining.
282
283if ($have_ntpq) {
284
285 if ( open(NTPQ, $ntpq . " -np $host 2>&1 |") ) {
286 while (<NTPQ>) {
287 print $_ if ($verbose);
288 if ( /timed out/ ){
289 $have_ntpq = 0 ;
290 last ;
291 }
292 # number of candidates on <host> for sys.peer
293 if (/^(\*|\+|\#|o])/) {
294 ++$candidate;
295 push (@candidates, $_);
296 print "Candidate count= $candidate\n" if ($verbose);
297 }
298
299 # match sys.peer or pps.peer
300 if (/^(\*|o)(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)/) {
301 $syspeer = $2;
302 $stratum = $4;
303 $jitter = $11;
304 print "match $_ \n" if $verbose;
305 if ($jitter > $jcrit) {
306 print "Jitter_crit = $11 :$jcrit\n" if ($verbose);
307 $jitter_error = $ERRORS{'CRITICAL'};
308 } elsif ($jitter > $jwarn ) {
309 print "Jitter_warn = $11 :$jwarn\n" if ($verbose);
310 $jitter_error = $ERRORS{'WARNING'};
311 } else {
312 $jitter_error = $ERRORS{'OK'};
313 }
314 } else {
315 print "No match!\n" if $verbose;
316 $jitter = '(not parsed)';
317 }
318
319 }
320 close NTPQ ||
321 die $! ? "Error closing $ntpq pipe: $!"
322 : "Exit status: $? from $ntpq\n";
323
324 # if we did not match sys.peer or pps.peer but matched # candidates only
325 # generate a warning
326 # based on bug id 773588
327 unless (defined $syspeer) {
328 if ($#candidates >=0) {
329 foreach my $c (@candidates) {
330 $c =~ /^(#)([-0-9.\s]+)\s+([-0-9A-Za-z_().]+)\s+([-0-9.]+)\s+([lumb-]+)\s+([-0-9m.]+)\s+([-0-9.]+)\s+([-0-9.]+)\s+([-0-9.]+)\s+([-0-9.]+)\s+([-0-9.]+)/;
331 $syspeer = $2;
332 $stratum = $4;
333 $jitter = $11;
334 print "candidate match $c \n" if $verbose;
335 if ($jitter > $jcrit) {
336 print "Candidate match - Jitter_crit = $11 :$jcrit\n" if ($verbose);
337 $jitter_error = $ERRORS{'CRITICAL'};
338 }elsif ($jitter > $jwarn ) {
339 print "Candidate match - Jitter_warn = $11 :$jwarn \n" if ($verbose);
340 $jitter_error = $ERRORS{'WARNING'};
341 } else {
342 $jitter_error = $ERRORS{'WARNING'};
343 }
344 }
345
346 }
347 }
348 }
349}
350
351
352if ($ntpdate_error != $ERRORS{'OK'}) {
353 $state = $ntpdate_error;
354 if ($ntpdate_error == $ERRORS{'WARNING'} ) {
355 $answer = $msg;
356 }
357 else {
358 $answer = $msg . "Server for ntp probably down";
359 }
360
361 if (defined($offset) && abs($offset) > $ocrit) {
362 $state = $ERRORS{'CRITICAL'};
363 $answer = "Server Error and offset $offset sec > +/- $ocrit sec";
364 } elsif (defined($offset) && abs($offset) > $owarn) {
365 $answer = "Server error and offset $offset sec > +/- $owarn sec";
366 } elsif (defined($jitter) && abs($jitter) > $jcrit) {
367 $answer = "Server error and jitter $jitter msec > +/- $jcrit msec";
368 } elsif (defined($jitter) && abs($jitter) > $jwarn) {
369 $answer = "Server error and jitter $jitter msec > +/- $jwarn msec";
370 }
371
372} elsif ($have_ntpq && $jitter_error != $ERRORS{'OK'}) {
373 $state = $jitter_error;
374 $answer = "Jitter $jitter too high";
375 if (defined($offset) && abs($offset) > $ocrit) {
376 $state = $ERRORS{'CRITICAL'};
377 $answer = "Jitter error and offset $offset sec > +/- $ocrit sec";
378 } elsif (defined($offset) && abs($offset) > $owarn) {
379 $answer = "Jitter error and offset $offset sec > +/- $owarn sec";
380 } elsif (defined($jitter) && abs($jitter) > $jcrit) {
381 $answer = "Jitter error and jitter $jitter msec > +/- $jcrit msec";
382 } elsif (defined($jitter) && abs($jitter) > $jwarn) {
383 $answer = "Jitter error and jitter $jitter msec > +/- $jwarn msec";
384 }
385
386} elsif( !$have_ntpq ) { # no errors from ntpdate and no ntpq or ntpq timed out
387 if (abs($offset) > $ocrit) {
388 $state = $ERRORS{'CRITICAL'};
389 $answer = "Offset $offset sec > +/- $ocrit sec";
390 } elsif (abs($offset) > $owarn) {
391 $state = $ERRORS{'WARNING'};
392 $answer = "Offset $offset sec > +/- $owarn sec";
393 } elsif (( abs($offset) > $owarn) && $def_jitter ) {
394 $state = $ERRORS{'WARNING'};
395 $answer = "Offset $offset sec > +/- $owarn sec, ntpq timed out";
396 } elsif ( $def_jitter ) {
397 $state = $ERRORS{'WARNING'};
398 $answer = "Offset $offset secs, ntpq timed out";
399 } else{
400 $state = $ERRORS{'OK'};
401 $answer = "Offset $offset secs";
402 }
403
404
405
406} else { # no errors from ntpdate or ntpq
407 if (abs($offset) > $ocrit) {
408 $state = $ERRORS{'CRITICAL'};
409 $answer = "Offset $offset sec > +/- $ocrit sec, jitter $jitter msec";
410 } elsif (abs($jitter) > $jcrit ) {
411 $state = $ERRORS{'CRITICAL'};
412 $answer = "Jitter $jitter msec> +/- $jcrit msec, offset $offset sec";
413 } elsif (abs($offset) > $owarn) {
414 $state = $ERRORS{'WARNING'};
415 $answer = "Offset $offset sec > +/- $owarn sec, jitter $jitter msec";
416 } elsif (abs($jitter) > $jwarn ) {
417 $state = $ERRORS{'WARNING'};
418 $answer = "Jitter $jitter msec> +/- $jwarn msec, offset $offset sec";
419
420 } else {
421 $state = $ERRORS{'OK'};
422 $answer = "Offset $offset secs, jitter $jitter msec, peer is stratum $stratum";
423 }
424
425}
426
427foreach my $key (keys %ERRORS) {
428 if ($state==$ERRORS{$key}) {
429# print ("NTP $key: $answer");
430 print ("NTP $key: $answer|offset=$offset, jitter=" . $jitter/1000 . ",peer_stratum=$stratum\n");
431 last;
432 }
433}
434exit $state;
435
436
437####
438#### subs
439
440sub print_usage () {
441 print "Usage: $PROGNAME -H <host> [-46] [-O] [-w <warn>] [-c <crit>] [-j <warn>] [-k <crit>] [-v verbose]\n";
442}
443
444sub print_help () {
445 print_revision($PROGNAME,'@NP_VERSION@');
446 print "Copyright (c) 2003 Bo Kersey/Karl DeBisschop\n";
447 print "\n";
448 print_usage();
449 print "
450Checks the local timestamp offset versus <host> with ntpdate
451Checks the jitter/dispersion of clock signal between <host> and its sys.peer with ntpq\n
452-O (--zero-offset)
453 A zero offset on \"ntpdate\" will generate a CRITICAL.\n
454-w (--warning)
455 Clock offset in seconds at which a warning message will be generated.\n Defaults to $DEFAULT_OFFSET_WARN.
456-c (--critical)
457 Clock offset in seconds at which a critical message will be generated.\n Defaults to $DEFAULT_OFFSET_CRIT.
458-j (--jwarn)
459 Clock jitter in milliseconds at which a warning message will be generated.\n Defaults to $DEFAULT_JITTER_WARN.
460-k (--jcrit)
461 Clock jitter in milliseconds at which a critical message will be generated.\n Defaults to $DEFAULT_JITTER_CRIT.
462
463 If jitter/dispersion is specified with -j or -k and ntpq times out, then a
464 warning is returned.\n
465-4 (--use-ipv4)
466 Use IPv4 connection
467-6 (--use-ipv6)
468 Use IPv6 connection
469\n";
470support();
471}
diff --git a/plugins-scripts/check_oracle.sh b/plugins-scripts/check_oracle.sh
index 77eba2e..b653372 100755
--- a/plugins-scripts/check_oracle.sh
+++ b/plugins-scripts/check_oracle.sh
@@ -3,7 +3,7 @@
3# latigid010@yahoo.com 3# latigid010@yahoo.com
4# 01/06/2000 4# 01/06/2000
5# 5#
6# This Nagios plugin was created to check Oracle status 6# This Monitoring plugin was created to check Oracle status
7# 7#
8 8
9PROGNAME=`basename $0` 9PROGNAME=`basename $0`
diff --git a/plugins-scripts/check_rpc.pl b/plugins-scripts/check_rpc.pl
index d2701e9..474067e 100755
--- a/plugins-scripts/check_rpc.pl
+++ b/plugins-scripts/check_rpc.pl
@@ -1,6 +1,6 @@
1#!/usr/local/bin/perl -w 1#!/usr/local/bin/perl -w
2# 2#
3# check_rpc plugin for nagios 3# check_rpc plugin for monitoring
4# 4#
5# usage: 5# usage:
6# check_rpc host service 6# check_rpc host service
@@ -254,7 +254,7 @@ $proto = 't' if ($opt_t);
254$proto = 'u' if ($opt_u); 254$proto = 'u' if ($opt_u);
255 255
256 256
257# Just in case of problems, let's not hang Nagios 257# Just in case of problems, let's not hang the monitoring system
258$SIG{'ALRM'} = sub { 258$SIG{'ALRM'} = sub {
259 print ("ERROR: No response from RPC server (alarm)\n"); 259 print ("ERROR: No response from RPC server (alarm)\n");
260 exit $ERRORS{"UNKNOWN"}; 260 exit $ERRORS{"UNKNOWN"};
diff --git a/plugins-scripts/t/check_file_age.t b/plugins-scripts/t/check_file_age.t
index 384c276..a515649 100644
--- a/plugins-scripts/t/check_file_age.t
+++ b/plugins-scripts/t/check_file_age.t
@@ -5,7 +5,7 @@
5# 5#
6 6
7use strict; 7use strict;
8use Test::More tests => 15; 8use Test::More tests => 16;
9use NPTest; 9use NPTest;
10 10
11my $successOutput = '/^FILE_AGE OK: /'; 11my $successOutput = '/^FILE_AGE OK: /';
@@ -58,6 +58,11 @@ $result = NPTest->testCmd(
58cmp_ok( $result->return_code, '==', 0, "Checking file size" ); 58cmp_ok( $result->return_code, '==', 0, "Checking file size" );
59 59
60$result = NPTest->testCmd( 60$result = NPTest->testCmd(
61 "./check_file_age -f /non/existent --ignore-missing"
62 );
63cmp_ok( $result->return_code, '==', 0, "Honours --ignore-missing" );
64
65$result = NPTest->testCmd(
61 "./check_file_age -f $temp_file -c 1000 -W 101" 66 "./check_file_age -f $temp_file -c 1000 -W 101"
62 ); 67 );
63cmp_ok( $result->return_code, '==', 1, "One byte too short" ); 68cmp_ok( $result->return_code, '==', 1, "One byte too short" );
diff --git a/plugins-scripts/utils.pm.in b/plugins-scripts/utils.pm.in
index 37cd62c..0f53243 100644
--- a/plugins-scripts/utils.pm.in
+++ b/plugins-scripts/utils.pm.in
@@ -1,6 +1,6 @@
1# Utility drawer for Nagios plugins. 1# Utility drawer for Monitoring Plugins.
2# 2#
3# This will be deprecated soon. Please use Nagios::Plugin from CPAN 3# This will be deprecated soon. Please use Monitoring::Plugin from CPAN
4# for new plugins 4# for new plugins
5 5
6package utils; 6package utils;
diff --git a/plugins-scripts/utils.sh.in b/plugins-scripts/utils.sh.in
index 4a07df8..031c035 100644
--- a/plugins-scripts/utils.sh.in
+++ b/plugins-scripts/utils.sh.in
@@ -6,19 +6,13 @@ STATE_CRITICAL=2
6STATE_UNKNOWN=3 6STATE_UNKNOWN=3
7STATE_DEPENDENT=4 7STATE_DEPENDENT=4
8 8
9if test -x /usr/bin/printf; then
10 ECHO=/usr/bin/printf
11else
12 ECHO=echo
13fi
14
15print_revision() { 9print_revision() {
16 echo "$1 v$2 (@PACKAGE@ @VERSION@)" 10 echo "$1 v$2 (@PACKAGE@ @VERSION@)"
17 $ECHO "@WARRANTY@" | sed -e 's/\n/ /g' 11 printf '%b' "@WARRANTY@"
18} 12}
19 13
20support() { 14support() {
21 $ECHO "@SUPPORT@" | sed -e 's/\n/ /g' 15 printf '%b' "@SUPPORT@"
22} 16}
23 17
24# 18#