summaryrefslogtreecommitdiffstats
path: root/plugins-scripts
diff options
context:
space:
mode:
authorLorenz Kästle <12514511+RincewindsHat@users.noreply.github.com>2023-09-20 06:16:11 (GMT)
committerGitHub <noreply@github.com>2023-09-20 06:16:11 (GMT)
commita5ba424f85153b1ddaaf5e5269c82f0f049828d0 (patch)
treeb9c158930159f2ab1ea2eb45e9e19ccdd0fbb76b /plugins-scripts
parenta99db0243baa5d208c5d500a9bde86b4619cec92 (diff)
parent220455a11e8f1dd3a86ac4725cf0c799c8e3b21b (diff)
downloadmonitoring-plugins-a5ba424f85153b1ddaaf5e5269c82f0f049828d0.tar.gz
Merge branch 'master' into masterrefs/pull/1637/head
Diffstat (limited to 'plugins-scripts')
-rw-r--r--plugins-scripts/Makefile.am4
-rwxr-xr-xplugins-scripts/check_breeze.pl3
-rw-r--r--plugins-scripts/check_disk_smb.pl2
-rwxr-xr-xplugins-scripts/check_ifoperstatus.pl8
-rwxr-xr-xplugins-scripts/check_ifstatus.pl2
-rwxr-xr-xplugins-scripts/check_ircd.pl4
-rwxr-xr-xplugins-scripts/check_log.sh4
-rwxr-xr-xplugins-scripts/check_mailq.pl38
-rwxr-xr-xplugins-scripts/check_oracle.sh16
-rwxr-xr-xplugins-scripts/check_rpc.pl2
-rwxr-xr-xplugins-scripts/check_sensors.sh8
-rwxr-xr-xplugins-scripts/check_uptime.pl2
-rwxr-xr-xplugins-scripts/check_wave.pl15
-rw-r--r--plugins-scripts/utils.pm.in1
14 files changed, 68 insertions, 41 deletions
diff --git a/plugins-scripts/Makefile.am b/plugins-scripts/Makefile.am
index 088a445..7879791 100644
--- a/plugins-scripts/Makefile.am
+++ b/plugins-scripts/Makefile.am
@@ -16,13 +16,13 @@ VPATH=$(top_srcdir) $(top_srcdir)/plugins-scripts $(top_srcdir)/plugins-scripts/
16libexec_SCRIPTS = check_breeze check_disk_smb check_flexlm check_ircd \ 16libexec_SCRIPTS = check_breeze check_disk_smb check_flexlm check_ircd \
17 check_log check_oracle check_rpc check_sensors check_wave \ 17 check_log check_oracle check_rpc check_sensors check_wave \
18 check_ifstatus check_ifoperstatus check_mailq check_file_age \ 18 check_ifstatus check_ifoperstatus check_mailq check_file_age \
19 check_uptime \ 19 check_uptime check_mssql \
20 utils.sh utils.pm 20 utils.sh utils.pm
21 21
22EXTRA_DIST=check_breeze.pl check_disk_smb.pl check_flexlm.pl check_ircd.pl \ 22EXTRA_DIST=check_breeze.pl check_disk_smb.pl check_flexlm.pl check_ircd.pl \
23 check_log.sh check_oracle.sh check_rpc.pl check_sensors.sh \ 23 check_log.sh check_oracle.sh check_rpc.pl check_sensors.sh \
24 check_ifstatus.pl check_ifoperstatus.pl check_wave.pl check_mailq.pl check_file_age.pl \ 24 check_ifstatus.pl check_ifoperstatus.pl check_wave.pl check_mailq.pl check_file_age.pl \
25 check_uptime.pl \ 25 check_uptime.pl check_mssql.pl \
26 utils.sh.in utils.pm.in t 26 utils.sh.in utils.pm.in t
27 27
28EDIT = sed \ 28EDIT = sed \
diff --git a/plugins-scripts/check_breeze.pl b/plugins-scripts/check_breeze.pl
index 05b9920..531625c 100755
--- a/plugins-scripts/check_breeze.pl
+++ b/plugins-scripts/check_breeze.pl
@@ -14,8 +14,9 @@ sub print_help ();
14sub print_usage (); 14sub print_usage ();
15 15
16$ENV{'PATH'}='@TRUSTED_PATH@'; 16$ENV{'PATH'}='@TRUSTED_PATH@';
17$ENV{'BASH_ENV'}=''; 17$ENV{'BASH_ENV'}='';
18$ENV{'ENV'}=''; 18$ENV{'ENV'}='';
19$ENV{'CDPATH'}='';
19 20
20Getopt::Long::Configure('bundling'); 21Getopt::Long::Configure('bundling');
21GetOptions 22GetOptions
diff --git a/plugins-scripts/check_disk_smb.pl b/plugins-scripts/check_disk_smb.pl
index 15d1634..f4d33a7 100644
--- a/plugins-scripts/check_disk_smb.pl
+++ b/plugins-scripts/check_disk_smb.pl
@@ -28,7 +28,7 @@ use FindBin;
28use lib "$FindBin::Bin"; 28use lib "$FindBin::Bin";
29use utils qw($TIMEOUT %ERRORS &print_revision &support &usage); 29use utils qw($TIMEOUT %ERRORS &print_revision &support &usage);
30 30
31# make us session leader which makes all childs exit if we do 31# make us session leader which makes all children exit if we do
32setsid; 32setsid;
33 33
34sub print_help (); 34sub print_help ();
diff --git a/plugins-scripts/check_ifoperstatus.pl b/plugins-scripts/check_ifoperstatus.pl
index c190ce9..e335cda 100755
--- a/plugins-scripts/check_ifoperstatus.pl
+++ b/plugins-scripts/check_ifoperstatus.pl
@@ -134,7 +134,7 @@ if (defined $ifdescr || defined $iftype) {
134 } 134 }
135 if ($status==0) { 135 if ($status==0) {
136 $state = "UNKNOWN"; 136 $state = "UNKNOWN";
137 printf "$state: could not retrive ifdescr/iftype snmpkey - $status-$snmpkey\n"; 137 printf "$state: could not retrieve ifdescr/iftype snmpkey - $status-$snmpkey\n";
138 $session->close; 138 $session->close;
139 exit $ERRORS{$state}; 139 exit $ERRORS{$state};
140 } 140 }
@@ -187,7 +187,7 @@ if (defined $ifXTable) {
187 $name = $response->{$snmpIfDescr} ; 187 $name = $response->{$snmpIfDescr} ;
188} 188}
189 189
190## if AdminStatus is down - some one made a consious effort to change config 190## if AdminStatus is down - some one made a conscious effort to change config
191## 191##
192if ( not ($response->{$snmpIfAdminStatus} == 1) ) { 192if ( not ($response->{$snmpIfAdminStatus} == 1) ) {
193 $answer = "Interface $name (index $snmpkey) is administratively down."; 193 $answer = "Interface $name (index $snmpkey) is administratively down.";
@@ -286,7 +286,7 @@ sub print_usage() {
286 printf "check_ifoperstatus -k <IF_KEY> -H <HOSTNAME> [-C <community>]\n"; 286 printf "check_ifoperstatus -k <IF_KEY> -H <HOSTNAME> [-C <community>]\n";
287 printf "Copyright (C) 2000 Christoph Kron\n"; 287 printf "Copyright (C) 2000 Christoph Kron\n";
288 printf "check_ifoperstatus.pl comes with ABSOLUTELY NO WARRANTY\n"; 288 printf "check_ifoperstatus.pl comes with ABSOLUTELY NO WARRANTY\n";
289 printf "This programm is licensed under the terms of the "; 289 printf "This program is licensed under the terms of the ";
290 printf "GNU General Public License\n(check source code for details)\n"; 290 printf "GNU General Public License\n(check source code for details)\n";
291 printf "\n\n"; 291 printf "\n\n";
292} 292}
@@ -424,7 +424,7 @@ sub process_arguments() {
424 if (defined $seclevel && defined $secname) { 424 if (defined $seclevel && defined $secname) {
425 $session_opts{'-username'} = $secname; 425 $session_opts{'-username'} = $secname;
426 426
427 # Must define a security level even though defualt is noAuthNoPriv 427 # Must define a security level even though default is noAuthNoPriv
428 unless ( grep /^$seclevel$/, qw(noAuthNoPriv authNoPriv authPriv) ) { 428 unless ( grep /^$seclevel$/, qw(noAuthNoPriv authNoPriv authPriv) ) {
429 usage("Must define a valid security level even though default is noAuthNoPriv"); 429 usage("Must define a valid security level even though default is noAuthNoPriv");
430 } 430 }
diff --git a/plugins-scripts/check_ifstatus.pl b/plugins-scripts/check_ifstatus.pl
index 0ae3b4c..f0b7c49 100755
--- a/plugins-scripts/check_ifstatus.pl
+++ b/plugins-scripts/check_ifstatus.pl
@@ -370,7 +370,7 @@ sub process_arguments() {
370 if (defined $seclevel && defined $secname) { 370 if (defined $seclevel && defined $secname) {
371 $session_opts{'-username'} = $secname; 371 $session_opts{'-username'} = $secname;
372 372
373 # Must define a security level even though defualt is noAuthNoPriv 373 # Must define a security level even though default is noAuthNoPriv
374 unless ( grep /^$seclevel$/, qw(noAuthNoPriv authNoPriv authPriv) ) { 374 unless ( grep /^$seclevel$/, qw(noAuthNoPriv authNoPriv authPriv) ) {
375 usage("Must define a valid security level even though default is noAuthNoPriv"); 375 usage("Must define a valid security level even though default is noAuthNoPriv");
376 } 376 }
diff --git a/plugins-scripts/check_ircd.pl b/plugins-scripts/check_ircd.pl
index d869ae7..84f2022 100755
--- a/plugins-scripts/check_ircd.pl
+++ b/plugins-scripts/check_ircd.pl
@@ -60,7 +60,7 @@ sub print_usage ();
60sub connection ($$$$); 60sub connection ($$$$);
61sub bindRemote ($$); 61sub bindRemote ($$);
62 62
63# -------------------------------------------------------------[ Enviroment ]-- 63# -------------------------------------------------------------[ Environment ]--
64 64
65$ENV{'PATH'}='@TRUSTED_PATH@'; 65$ENV{'PATH'}='@TRUSTED_PATH@';
66$ENV{'BASH_ENV'}=''; 66$ENV{'BASH_ENV'}='';
@@ -208,7 +208,7 @@ MAIN:
208 208
209 # Just in case of problems, let's not hang the monitoring system 209 # Just in case of problems, let's not hang the monitoring system
210 $SIG{'ALRM'} = sub { 210 $SIG{'ALRM'} = sub {
211 print "Somthing is Taking a Long Time, Increase Your TIMEOUT (Currently Set At $TIMEOUT Seconds)\n"; 211 print "Something is Taking a Long Time, Increase Your TIMEOUT (Currently Set At $TIMEOUT Seconds)\n";
212 exit $ERRORS{"UNKNOWN"}; 212 exit $ERRORS{"UNKNOWN"};
213 }; 213 };
214 214
diff --git a/plugins-scripts/check_log.sh b/plugins-scripts/check_log.sh
index c623a8d..8ecdd31 100755
--- a/plugins-scripts/check_log.sh
+++ b/plugins-scripts/check_log.sh
@@ -105,11 +105,11 @@ while test -n "$1"; do
105 case "$1" in 105 case "$1" in
106 -h | --help) 106 -h | --help)
107 print_help 107 print_help
108 exit "$STATE_OK" 108 exit "$STATE_UNKNOWN"
109 ;; 109 ;;
110 -V | --version) 110 -V | --version)
111 print_revision "$PROGNAME" "$REVISION" 111 print_revision "$PROGNAME" "$REVISION"
112 exit "$STATE_OK" 112 exit "$STATE_UNKNOWN"
113 ;; 113 ;;
114 -F | --filename) 114 -F | --filename)
115 logfile=$2 115 logfile=$2
diff --git a/plugins-scripts/check_mailq.pl b/plugins-scripts/check_mailq.pl
index 27073d3..49156af 100755
--- a/plugins-scripts/check_mailq.pl
+++ b/plugins-scripts/check_mailq.pl
@@ -4,7 +4,7 @@
4# transmittal. 4# transmittal.
5# 5#
6# Initial version support sendmail's mailq command 6# Initial version support sendmail's mailq command
7# Support for mutiple sendmail queues (Carlos Canau) 7# Support for multiple sendmail queues (Carlos Canau)
8# Support for qmail (Benjamin Schmid) 8# Support for qmail (Benjamin Schmid)
9 9
10# License Information: 10# License Information:
@@ -149,7 +149,26 @@ if ($mailq eq "sendmail") {
149##/var/spool/mqueue/qF/df is empty 149##/var/spool/mqueue/qF/df is empty
150## Total Requests: 1 150## Total Requests: 1
151 151
152 152# separate submission/transport queues, empty
153## MSP Queue status...
154## /var/spool/mqueue-client is empty
155## Total requests: 0
156## MTA Queue status...
157## /var/spool/mqueue is empty
158## Total requests: 0
159# separate submission/transport queues: 1
160## MSP Queue status...
161## /var/spool/mqueue-client (1 request)
162## -----Q-ID----- --Size-- -----Q-Time----- ------------Sender/Recipient-----------
163## oAJEfhdW014123 5 Fri Nov 19 14:41 jwm
164## (Deferred: Connection refused by [127.0.0.1])
165## root
166## Total requests: 1
167## MTA Queue status...
168## /var/spool/mqueue is empty
169## Total requests: 0
170
171 my $this_msg_q = 0;
153 while (<MAILQ>) { 172 while (<MAILQ>) {
154 173
155 # match email addr on queue listing 174 # match email addr on queue listing
@@ -189,13 +208,18 @@ if ($mailq eq "sendmail") {
189 # 208 #
190 # single queue: first line 209 # single queue: first line
191 # multi queue: one for each queue. overwrite on multi queue below 210 # multi queue: one for each queue. overwrite on multi queue below
192 $msg_q = $1 ; 211 $this_msg_q = $1 ;
212 $msg_q += $1 ;
193 } 213 }
194 } elsif (/^\s+Total\sRequests:\s(\d+)$/i) { 214 } elsif (/^\s+Total\sRequests:\s(\d+)$/i) {
195 print "$utils::PATH_TO_MAILQ = $_ \n" if $verbose ; 215 if ($this_msg_q) {
196 # 216 $this_msg_q = 0 ;
197 # multi queue: last line 217 } else {
198 $msg_q = $1 ; 218 print "$utils::PATH_TO_MAILQ = $_ \n" if $verbose ;
219 #
220 # multi queue: last line
221 $msg_q += $1 ;
222 }
199 } 223 }
200 224
201 } 225 }
diff --git a/plugins-scripts/check_oracle.sh b/plugins-scripts/check_oracle.sh
index b14ec50..5998138 100755
--- a/plugins-scripts/check_oracle.sh
+++ b/plugins-scripts/check_oracle.sh
@@ -86,20 +86,20 @@ esac
86# Information options 86# Information options
87case "$cmd" in 87case "$cmd" in
88--help) 88--help)
89 print_help 89 print_help
90 exit "$STATE_OK" 90 exit "$STATE_UNKNOWN"
91 ;; 91 ;;
92-h) 92-h)
93 print_help 93 print_help
94 exit "$STATE_OK" 94 exit "$STATE_UNKNOWN"
95 ;; 95 ;;
96--version) 96--version)
97 print_revision "$PROGNAME" "$REVISION" 97 print_revision "$PROGNAME" "$REVISION"
98 exit "$STATE_OK" 98 exit "$STATE_UNKNOWN"
99 ;; 99 ;;
100-V) 100-V)
101 print_revision "$PROGNAME" "$REVISION" 101 print_revision "$PROGNAME" "$REVISION"
102 exit "$STATE_OK" 102 exit "$STATE_UNKNOWN"
103 ;; 103 ;;
104esac 104esac
105 105
diff --git a/plugins-scripts/check_rpc.pl b/plugins-scripts/check_rpc.pl
index 47d6e49..8a56b9f 100755
--- a/plugins-scripts/check_rpc.pl
+++ b/plugins-scripts/check_rpc.pl
@@ -5,7 +5,7 @@
5# usage: 5# usage:
6# check_rpc host service 6# check_rpc host service
7# 7#
8# Check if an rpc serice is registered and running 8# Check if an rpc service is registered and running
9# using rpcinfo - $proto $host $prognum 2>&1 |"; 9# using rpcinfo - $proto $host $prognum 2>&1 |";
10# 10#
11# Use these hosts.cfg entries as examples 11# Use these hosts.cfg entries as examples
diff --git a/plugins-scripts/check_sensors.sh b/plugins-scripts/check_sensors.sh
index 921e7b3..866e0e0 100755
--- a/plugins-scripts/check_sensors.sh
+++ b/plugins-scripts/check_sensors.sh
@@ -26,19 +26,19 @@ print_help() {
26case "$1" in 26case "$1" in
27 --help) 27 --help)
28 print_help 28 print_help
29 exit "$STATE_OK" 29 exit "$STATE_UNKNOWN"
30 ;; 30 ;;
31 -h) 31 -h)
32 print_help 32 print_help
33 exit "$STATE_OK" 33 exit "$STATE_UNKNOWN"
34 ;; 34 ;;
35 --version) 35 --version)
36 print_revision "$PROGNAME" "$REVISION" 36 print_revision "$PROGNAME" "$REVISION"
37 exit "$STATE_OK" 37 exit "$STATE_UNKNOWN"
38 ;; 38 ;;
39 -V) 39 -V)
40 print_revision "$PROGNAME" "$REVISION" 40 print_revision "$PROGNAME" "$REVISION"
41 exit "$STATE_OK" 41 exit "$STATE_UNKNOWN"
42 ;; 42 ;;
43 *) 43 *)
44 sensordata=$(sensors 2>&1) 44 sensordata=$(sensors 2>&1)
diff --git a/plugins-scripts/check_uptime.pl b/plugins-scripts/check_uptime.pl
index f954287..d73e40e 100755
--- a/plugins-scripts/check_uptime.pl
+++ b/plugins-scripts/check_uptime.pl
@@ -110,7 +110,7 @@ $pretty_uptime .= sprintf( "%d week%s, ", $weeks, $weeks == 1 ? "" : "s" ) if
110$pretty_uptime .= sprintf( "%d day%s, ", $days, $days == 1 ? "" : "s" ) if $days; 110$pretty_uptime .= sprintf( "%d day%s, ", $days, $days == 1 ? "" : "s" ) if $days;
111$pretty_uptime .= sprintf( "%d hour%s, ", $hours, $hours == 1 ? "" : "s" ) if $hours; 111$pretty_uptime .= sprintf( "%d hour%s, ", $hours, $hours == 1 ? "" : "s" ) if $hours;
112$pretty_uptime .= sprintf( "%d minute%s, ", $mins, $mins == 1 ? "" : "s" ) if $mins; 112$pretty_uptime .= sprintf( "%d minute%s, ", $mins, $mins == 1 ? "" : "s" ) if $mins;
113# Replace last occurence of comma with "and" 113# Replace last occurrence of comma with "and"
114$pretty_uptime =~ s/, $/ and /; 114$pretty_uptime =~ s/, $/ and /;
115# Always print the seconds (though it may be 0 seconds) 115# Always print the seconds (though it may be 0 seconds)
116$pretty_uptime .= sprintf( "%d second%s", $secs, $secs == 1 ? "" : "s" ); 116$pretty_uptime .= sprintf( "%d second%s", $secs, $secs == 1 ? "" : "s" );
diff --git a/plugins-scripts/check_wave.pl b/plugins-scripts/check_wave.pl
index 41e15f5..c24015c 100755
--- a/plugins-scripts/check_wave.pl
+++ b/plugins-scripts/check_wave.pl
@@ -19,6 +19,7 @@ sub print_usage ();
19$ENV{'PATH'}='@TRUSTED_PATH@'; 19$ENV{'PATH'}='@TRUSTED_PATH@';
20$ENV{'BASH_ENV'}=''; 20$ENV{'BASH_ENV'}='';
21$ENV{'ENV'}=''; 21$ENV{'ENV'}='';
22$ENV{'CDPATH'}='';
22 23
23Getopt::Long::Configure('bundling'); 24Getopt::Long::Configure('bundling');
24GetOptions 25GetOptions
@@ -50,34 +51,34 @@ my $critical = $1 if ($opt_c =~ /([0-9]+)/);
50($opt_w) || ($opt_w = shift) || ($opt_w = 60); 51($opt_w) || ($opt_w = shift) || ($opt_w = 60);
51my $warning = $1 if ($opt_w =~ /([0-9]+)/); 52my $warning = $1 if ($opt_w =~ /([0-9]+)/);
52 53
53$low1 = `snmpget $host public .1.3.6.1.4.1.74.2.21.1.2.1.8.1`; 54$low1 = `$utils::PATH_TO_SNMPGET $host public .1.3.6.1.4.1.74.2.21.1.2.1.8.1`;
54@test = split(/ /,$low1); 55@test = split(/ /,$low1);
55$low1 = $test[2]; 56$low1 = $test[2];
56 57
57$med1 = `snmpget $host public .1.3.6.1.4.1.74.2.21.1.2.1.9.1`; 58$med1 = `$utils::PATH_TO_SNMPGET $host public .1.3.6.1.4.1.74.2.21.1.2.1.9.1`;
58@test = split(/ /,$med1); 59@test = split(/ /,$med1);
59$med1 = $test[2]; 60$med1 = $test[2];
60 61
61$high1 = `snmpget $host public .1.3.6.1.4.1.74.2.21.1.2.1.10.1`; 62$high1 = `$utils::PATH_TO_SNMPGET $host public .1.3.6.1.4.1.74.2.21.1.2.1.10.1`;
62@test = split(/ /,$high1); 63@test = split(/ /,$high1);
63$high1 = $test[2]; 64$high1 = $test[2];
64 65
65sleep(2); 66sleep(2);
66 67
67$snr = `snmpget $host public .1.3.6.1.4.1.762.2.5.2.1.17.1`; 68$snr = `$utils::PATH_TO_SNMPGET $host public .1.3.6.1.4.1.762.2.5.2.1.17.1`;
68@test = split(/ /,$snr); 69@test = split(/ /,$snr);
69$snr = $test[2]; 70$snr = $test[2];
70$snr = int($snr*25); 71$snr = int($snr*25);
71 72
72$low2 = `snmpget $host public .1.3.6.1.4.1.74.2.21.1.2.1.8.1`; 73$low2 = `$utils::PATH_TO_SNMPGET $host public .1.3.6.1.4.1.74.2.21.1.2.1.8.1`;
73@test = split(/ /,$low2); 74@test = split(/ /,$low2);
74$low2 = $test[2]; 75$low2 = $test[2];
75 76
76$med2 = `snmpget $host public .1.3.6.1.4.1.74.2.21.1.2.1.9.1`; 77$med2 = `$utils::PATH_TO_SNMPGET $host public .1.3.6.1.4.1.74.2.21.1.2.1.9.1`;
77@test = split(/ /,$med2); 78@test = split(/ /,$med2);
78$med2 = $test[2]; 79$med2 = $test[2];
79 80
80$high2 = `snmpget $host public .1.3.6.1.4.1.74.2.21.1.2.1.10.1`; 81$high2 = `$utils::PATH_TO_SNMPGET $host public .1.3.6.1.4.1.74.2.21.1.2.1.10.1`;
81@test = split(/ /,$high2); 82@test = split(/ /,$high2);
82$high2 = $test[2]; 83$high2 = $test[2];
83 84
diff --git a/plugins-scripts/utils.pm.in b/plugins-scripts/utils.pm.in
index 386831e..c84769f 100644
--- a/plugins-scripts/utils.pm.in
+++ b/plugins-scripts/utils.pm.in
@@ -23,6 +23,7 @@ $PATH_TO_LMSTAT = "@PATH_TO_LMSTAT@" ;
23$PATH_TO_SMBCLIENT = "@PATH_TO_SMBCLIENT@" ; 23$PATH_TO_SMBCLIENT = "@PATH_TO_SMBCLIENT@" ;
24$PATH_TO_MAILQ = "@PATH_TO_MAILQ@"; 24$PATH_TO_MAILQ = "@PATH_TO_MAILQ@";
25$PATH_TO_QMAIL_QSTAT = "@PATH_TO_QMAIL_QSTAT@"; 25$PATH_TO_QMAIL_QSTAT = "@PATH_TO_QMAIL_QSTAT@";
26$PATH_TO_SNMPGET = "@PATH_TO_SNMPGET@";
26 27
27## common variables 28## common variables
28$TIMEOUT = 15; 29$TIMEOUT = 15;