diff options
Diffstat (limited to 'plugins-scripts')
-rwxr-xr-x | plugins-scripts/check_file_age.pl | 2 | ||||
-rwxr-xr-x | plugins-scripts/check_log.sh | 138 | ||||
-rwxr-xr-x | plugins-scripts/check_mailq.pl | 26 | ||||
-rwxr-xr-x | plugins-scripts/check_oracle.sh | 240 | ||||
-rwxr-xr-x | plugins-scripts/check_sensors.sh | 32 |
5 files changed, 250 insertions, 188 deletions
diff --git a/plugins-scripts/check_file_age.pl b/plugins-scripts/check_file_age.pl index 01b854a..26281dd 100755 --- a/plugins-scripts/check_file_age.pl +++ b/plugins-scripts/check_file_age.pl | |||
@@ -147,7 +147,7 @@ sub print_help () { | |||
147 | print "\n"; | 147 | print "\n"; |
148 | print " -i | --ignore-missing : return OK if the file does not exist\n"; | 148 | print " -i | --ignore-missing : return OK if the file does not exist\n"; |
149 | print " <secs> File must be no more than this many seconds old (default: warn 240 secs, crit 600)\n"; | 149 | print " <secs> File must be no more than this many seconds old (default: warn 240 secs, crit 600)\n"; |
150 | print " <size> File must be at least this many bytes long (default: crit 0 bytes)\n\n"; | 150 | print " <size> File must be at least this many bytes long (default: file size is ignored (0 bytes))\n\n"; |
151 | print " Both <secs> and <size> can specify a range using the standard plugin syntax\n"; | 151 | print " Both <secs> and <size> can specify a range using the standard plugin syntax\n"; |
152 | print " If any of the warning and critical arguments are in range syntax (not just bare numbers)\n"; | 152 | print " If any of the warning and critical arguments are in range syntax (not just bare numbers)\n"; |
153 | print " then all warning and critical arguments will be interpreted as ranges.\n"; | 153 | print " then all warning and critical arguments will be interpreted as ranges.\n"; |
diff --git a/plugins-scripts/check_log.sh b/plugins-scripts/check_log.sh index d28c8d0..6113123 100755 --- a/plugins-scripts/check_log.sh +++ b/plugins-scripts/check_log.sh | |||
@@ -1,8 +1,7 @@ | |||
1 | #!/bin/sh | 1 | #!/bin/sh |
2 | # | 2 | # |
3 | # Log file pattern detector plugin for monitoring | 3 | # Log file pattern detector plugin for monitoring |
4 | # Written by Ethan Galstad (nagios@nagios.org) | 4 | # Written originally by Ethan Galstad (nagios@nagios.org) |
5 | # Last Modified: 07-31-1999 | ||
6 | # | 5 | # |
7 | # Usage: ./check_log <log_file> <old_log_file> <pattern> | 6 | # Usage: ./check_log <log_file> <old_log_file> <pattern> |
8 | # | 7 | # |
@@ -60,20 +59,25 @@ | |||
60 | 59 | ||
61 | PATH="@TRUSTED_PATH@" | 60 | PATH="@TRUSTED_PATH@" |
62 | export PATH | 61 | export PATH |
63 | PROGNAME=`basename $0` | 62 | PROGNAME=$(basename "$0") |
64 | PROGPATH=`echo $0 | sed -e 's,[\\/][^\\/][^\\/]*$,,'` | 63 | PROGPATH=$(echo "$0" | sed -e 's,[\\/][^\\/][^\\/]*$,,') |
65 | REVISION="@NP_VERSION@" | 64 | REVISION="@NP_VERSION@" |
66 | 65 | ||
67 | . $PROGPATH/utils.sh | 66 | . "$PROGPATH"/utils.sh |
68 | 67 | ||
69 | print_usage() { | 68 | print_usage() { |
70 | echo "Usage: $PROGNAME -F logfile -O oldlog -q query" | 69 | echo "Usage: $PROGNAME -F logfile -O oldlog -q query" |
71 | echo "Usage: $PROGNAME --help" | 70 | echo "Usage: $PROGNAME --help" |
72 | echo "Usage: $PROGNAME --version" | 71 | echo "Usage: $PROGNAME --version" |
72 | echo "" | ||
73 | echo "Other parameters:" | ||
74 | echo " -a|--all : Print all matching lines" | ||
75 | echo " -p|--perl-regex : Use perl style regular expressions in the query" | ||
76 | echo " -e|--extended-regex : Use extended style regular expressions in the query (not necessary for GNU grep)" | ||
73 | } | 77 | } |
74 | 78 | ||
75 | print_help() { | 79 | print_help() { |
76 | print_revision $PROGNAME $REVISION | 80 | print_revision "$PROGNAME" "$REVISION" |
77 | echo "" | 81 | echo "" |
78 | print_usage | 82 | print_usage |
79 | echo "" | 83 | echo "" |
@@ -87,7 +91,7 @@ print_help() { | |||
87 | 91 | ||
88 | if [ $# -lt 1 ]; then | 92 | if [ $# -lt 1 ]; then |
89 | print_usage | 93 | print_usage |
90 | exit $STATE_UNKNOWN | 94 | exit "$STATE_UNKNOWN" |
91 | fi | 95 | fi |
92 | 96 | ||
93 | # Grab the command line arguments | 97 | # Grab the command line arguments |
@@ -100,79 +104,118 @@ while test -n "$1"; do | |||
100 | case "$1" in | 104 | case "$1" in |
101 | --help) | 105 | --help) |
102 | print_help | 106 | print_help |
103 | exit $STATE_OK | 107 | exit "$STATE_OK" |
104 | ;; | 108 | ;; |
105 | -h) | 109 | -h) |
106 | print_help | 110 | print_help |
107 | exit $STATE_OK | 111 | exit "$STATE_OK" |
108 | ;; | 112 | ;; |
109 | --version) | 113 | --version) |
110 | print_revision $PROGNAME $REVISION | 114 | print_revision "$PROGNAME" "$REVISION" |
111 | exit $STATE_OK | 115 | exit "$STATE_OK" |
112 | ;; | 116 | ;; |
113 | -V) | 117 | -V) |
114 | print_revision $PROGNAME $REVISION | 118 | print_revision "$PROGNAME" "$REVISION" |
115 | exit $STATE_OK | 119 | exit "$STATE_OK" |
116 | ;; | 120 | ;; |
117 | --filename) | 121 | --filename) |
118 | logfile=$2 | 122 | logfile=$2 |
119 | shift | 123 | shift 2 |
120 | ;; | 124 | ;; |
121 | -F) | 125 | -F) |
122 | logfile=$2 | 126 | logfile=$2 |
123 | shift | 127 | shift 2 |
124 | ;; | 128 | ;; |
125 | --oldlog) | 129 | --oldlog) |
126 | oldlog=$2 | 130 | oldlog=$2 |
127 | shift | 131 | shift 2 |
128 | ;; | 132 | ;; |
129 | -O) | 133 | -O) |
130 | oldlog=$2 | 134 | oldlog=$2 |
131 | shift | 135 | shift 2 |
132 | ;; | 136 | ;; |
133 | --query) | 137 | --query) |
134 | query=$2 | 138 | query=$2 |
135 | shift | 139 | shift 2 |
136 | ;; | 140 | ;; |
137 | -q) | 141 | -q) |
138 | query=$2 | 142 | query=$2 |
139 | shift | 143 | shift 2 |
140 | ;; | 144 | ;; |
141 | -x) | 145 | -x) |
142 | exitstatus=$2 | 146 | exitstatus=$2 |
143 | shift | 147 | shift 2 |
144 | ;; | 148 | ;; |
145 | --exitstatus) | 149 | --exitstatus) |
146 | exitstatus=$2 | 150 | exitstatus=$2 |
151 | shift 2 | ||
152 | ;; | ||
153 | --extended-regex) | ||
154 | ERE=1 | ||
155 | shift | ||
156 | ;; | ||
157 | -e) | ||
158 | ERE=1 | ||
159 | shift | ||
160 | ;; | ||
161 | --perl-regex) | ||
162 | PRE=1 | ||
163 | shift | ||
164 | ;; | ||
165 | -p) | ||
166 | PRE=1 | ||
167 | shift | ||
168 | ;; | ||
169 | --all) | ||
170 | ALL=1 | ||
171 | shift | ||
172 | ;; | ||
173 | -a) | ||
174 | ALL=1 | ||
147 | shift | 175 | shift |
148 | ;; | 176 | ;; |
149 | *) | 177 | *) |
150 | echo "Unknown argument: $1" | 178 | echo "Unknown argument: $1" |
151 | print_usage | 179 | print_usage |
152 | exit $STATE_UNKNOWN | 180 | exit "$STATE_UNKNOWN" |
153 | ;; | 181 | ;; |
154 | esac | 182 | esac |
155 | shift | ||
156 | done | 183 | done |
157 | 184 | ||
185 | # Parameter sanity check | ||
186 | if [ $ERE ] && [ $PRE ] ; then | ||
187 | echo "Can not use extended and perl regex at the same time" | ||
188 | exit "$STATE_UNKNOWN" | ||
189 | fi | ||
190 | |||
191 | GREP="grep" | ||
192 | |||
193 | if [ $ERE ]; then | ||
194 | GREP="grep -E" | ||
195 | fi | ||
196 | |||
197 | if [ $PRE ]; then | ||
198 | GREP="grep -P" | ||
199 | fi | ||
200 | |||
158 | # If the source log file doesn't exist, exit | 201 | # If the source log file doesn't exist, exit |
159 | 202 | ||
160 | if [ ! -e $logfile ]; then | 203 | if [ ! -e "$logfile" ]; then |
161 | echo "Log check error: Log file $logfile does not exist!" | 204 | echo "Log check error: Log file $logfile does not exist!" |
162 | exit $STATE_UNKNOWN | 205 | exit "$STATE_UNKNOWN" |
163 | elif [ ! -r $logfile ] ; then | 206 | elif [ ! -r "$logfile" ] ; then |
164 | echo "Log check error: Log file $logfile is not readable!" | 207 | echo "Log check error: Log file $logfile is not readable!" |
165 | exit $STATE_UNKNOWN | 208 | exit "$STATE_UNKNOWN" |
166 | fi | 209 | fi |
167 | 210 | ||
168 | # If the old log file doesn't exist, this must be the first time | 211 | # If the old log file doesn't exist, this must be the first time |
169 | # we're running this test, so copy the original log file over to | 212 | # we're running this test, so copy the original log file over to |
170 | # the old diff file and exit | 213 | # the old diff file and exit |
171 | 214 | ||
172 | if [ ! -e $oldlog ]; then | 215 | if [ ! -e "$oldlog" ]; then |
173 | cat $logfile > $oldlog | 216 | cat "$logfile" > "$oldlog" |
174 | echo "Log check data initialized..." | 217 | echo "Log check data initialized..." |
175 | exit $STATE_OK | 218 | exit "$STATE_OK" |
176 | fi | 219 | fi |
177 | 220 | ||
178 | # The old log file exists, so compare it to the original log now | 221 | # The old log file exists, so compare it to the original log now |
@@ -180,31 +223,42 @@ fi | |||
180 | # The temporary file that the script should use while | 223 | # The temporary file that the script should use while |
181 | # processing the log file. | 224 | # processing the log file. |
182 | if [ -x /bin/mktemp ]; then | 225 | if [ -x /bin/mktemp ]; then |
183 | tempdiff=`/bin/mktemp /tmp/check_log.XXXXXXXXXX` | 226 | |
227 | tempdiff=$(/bin/mktemp /tmp/check_log.XXXXXXXXXX) | ||
184 | else | 228 | else |
185 | tempdiff=`/bin/date '+%H%M%S'` | 229 | tempdiff=$(/bin/date '+%H%M%S') |
186 | tempdiff="/tmp/check_log.${tempdiff}" | 230 | tempdiff="/tmp/check_log.${tempdiff}" |
187 | touch $tempdiff | 231 | touch "$tempdiff" |
188 | chmod 600 $tempdiff | 232 | chmod 600 "$tempdiff" |
189 | fi | 233 | fi |
190 | 234 | ||
191 | diff $logfile $oldlog | grep -v "^>" > $tempdiff | 235 | diff "$logfile" "$oldlog" | grep -v "^>" > "$tempdiff" |
236 | |||
237 | |||
238 | if [ $ALL ]; then | ||
239 | # Get the last matching entry in the diff file | ||
240 | entry=$($GREP "$query" "$tempdiff") | ||
192 | 241 | ||
193 | # Count the number of matching log entries we have | 242 | # Count the number of matching log entries we have |
194 | count=`grep -c "$query" $tempdiff` | 243 | count=$(echo "$entry" | wc -l) |
195 | 244 | ||
196 | # Get the last matching entry in the diff file | 245 | else |
197 | lastentry=`grep "$query" $tempdiff | tail -1` | 246 | # Count the number of matching log entries we have |
247 | count=$($GREP -c "$query" "$tempdiff") | ||
248 | |||
249 | # Get the last matching entry in the diff file | ||
250 | entry=$($GREP "$query" "$tempdiff" | tail -1) | ||
251 | fi | ||
198 | 252 | ||
199 | rm -f $tempdiff | 253 | rm -f "$tempdiff" |
200 | cat $logfile > $oldlog | 254 | cat "$logfile" > "$oldlog" |
201 | 255 | ||
202 | if [ "$count" = "0" ]; then # no matches, exit with no error | 256 | if [ "$count" = "0" ]; then # no matches, exit with no error |
203 | echo "Log check ok - 0 pattern matches found" | 257 | echo "Log check ok - 0 pattern matches found" |
204 | exitstatus=$STATE_OK | 258 | exitstatus=$STATE_OK |
205 | else # Print total matche count and the last entry we found | 259 | else # Print total matche count and the last entry we found |
206 | echo "($count) $lastentry" | 260 | echo "($count) $entry" |
207 | exitstatus=$STATE_CRITICAL | 261 | exitstatus=$STATE_CRITICAL |
208 | fi | 262 | fi |
209 | 263 | ||
210 | exit $exitstatus | 264 | exit "$exitstatus" |
diff --git a/plugins-scripts/check_mailq.pl b/plugins-scripts/check_mailq.pl index aac1310..3914f4a 100755 --- a/plugins-scripts/check_mailq.pl +++ b/plugins-scripts/check_mailq.pl | |||
@@ -28,9 +28,9 @@ | |||
28 | use POSIX; | 28 | use POSIX; |
29 | use strict; | 29 | use strict; |
30 | use Getopt::Long; | 30 | use Getopt::Long; |
31 | use vars qw($opt_V $opt_h $opt_v $verbose $PROGNAME $opt_w $opt_c $opt_t $opt_s | 31 | use vars qw($opt_V $opt_h $opt_v $verbose $PROGNAME $opt_w $opt_c $opt_t $opt_s $opt_d |
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 $mailq_args |
33 | %srcdomains %dstdomains); | 33 | @lines %srcdomains %dstdomains); |
34 | use FindBin; | 34 | use FindBin; |
35 | use lib "$FindBin::Bin"; | 35 | use lib "$FindBin::Bin"; |
36 | use utils qw(%ERRORS &print_revision &support &usage ); | 36 | use utils qw(%ERRORS &print_revision &support &usage ); |
@@ -48,6 +48,8 @@ $PROGNAME = "check_mailq"; | |||
48 | $mailq = 'sendmail'; # default | 48 | $mailq = 'sendmail'; # default |
49 | $msg_q = 0 ; | 49 | $msg_q = 0 ; |
50 | $msg_p = 0 ; | 50 | $msg_p = 0 ; |
51 | # If appended, must start with a space | ||
52 | $mailq_args = '' ; | ||
51 | $state = $ERRORS{'UNKNOWN'}; | 53 | $state = $ERRORS{'UNKNOWN'}; |
52 | 54 | ||
53 | Getopt::Long::Configure('bundling'); | 55 | Getopt::Long::Configure('bundling'); |
@@ -68,6 +70,10 @@ if ($opt_s) { | |||
68 | $sudo = ""; | 70 | $sudo = ""; |
69 | } | 71 | } |
70 | 72 | ||
73 | if ($opt_d) { | ||
74 | $mailq_args = $mailq_args . ' -C ' . $opt_d; | ||
75 | } | ||
76 | |||
71 | $SIG{'ALRM'} = sub { | 77 | $SIG{'ALRM'} = sub { |
72 | print ("ERROR: timed out waiting for $utils::PATH_TO_MAILQ \n"); | 78 | print ("ERROR: timed out waiting for $utils::PATH_TO_MAILQ \n"); |
73 | exit $ERRORS{"WARNING"}; | 79 | exit $ERRORS{"WARNING"}; |
@@ -309,8 +315,8 @@ elsif ( $mailq eq "postfix" ) { | |||
309 | 315 | ||
310 | ## open mailq | 316 | ## open mailq |
311 | if ( defined $utils::PATH_TO_MAILQ && -x $utils::PATH_TO_MAILQ ) { | 317 | if ( defined $utils::PATH_TO_MAILQ && -x $utils::PATH_TO_MAILQ ) { |
312 | if (! open (MAILQ, "$sudo $utils::PATH_TO_MAILQ | " ) ) { | 318 | if (! open (MAILQ, "$sudo $utils::PATH_TO_MAILQ$mailq_args | " ) ) { |
313 | print "ERROR: could not open $utils::PATH_TO_MAILQ \n"; | 319 | print "ERROR: could not open $utils::PATH_TO_MAILQ$mailq_args \n"; |
314 | exit $ERRORS{'UNKNOWN'}; | 320 | exit $ERRORS{'UNKNOWN'}; |
315 | } | 321 | } |
316 | }elsif( defined $utils::PATH_TO_MAILQ){ | 322 | }elsif( defined $utils::PATH_TO_MAILQ){ |
@@ -330,7 +336,7 @@ elsif ( $mailq eq "postfix" ) { | |||
330 | close MAILQ; | 336 | close MAILQ; |
331 | 337 | ||
332 | if ( $? ) { | 338 | if ( $? ) { |
333 | print "CRITICAL: Error code ".($?>>8)." returned from $utils::PATH_TO_MAILQ",$/; | 339 | print "CRITICAL: Error code ".($?>>8)." returned from $utils::PATH_TO_MAILQ$mailq_args",$/; |
334 | exit $ERRORS{CRITICAL}; | 340 | exit $ERRORS{CRITICAL}; |
335 | } | 341 | } |
336 | 342 | ||
@@ -343,7 +349,7 @@ elsif ( $mailq eq "postfix" ) { | |||
343 | }elsif ($lines[0]=~/Mail queue is empty/) { | 349 | }elsif ($lines[0]=~/Mail queue is empty/) { |
344 | $msg_q = 0; | 350 | $msg_q = 0; |
345 | }else{ | 351 | }else{ |
346 | print "Couldn't match $utils::PATH_TO_MAILQ output\n"; | 352 | print "Couldn't match $utils::PATH_TO_MAILQ$mailq_args output\n"; |
347 | exit $ERRORS{'UNKNOWN'}; | 353 | exit $ERRORS{'UNKNOWN'}; |
348 | } | 354 | } |
349 | 355 | ||
@@ -533,7 +539,7 @@ elsif ( $mailq eq "nullmailer" ) { | |||
533 | while (<MAILQ>) { | 539 | while (<MAILQ>) { |
534 | #2006-06-22 16:00:00 282 bytes | 540 | #2006-06-22 16:00:00 282 bytes |
535 | 541 | ||
536 | 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$/) { | 542 | if (/^[1-9][0-9]*-[01][0-9]-[0-3][0-9]\s[0-2][0-9]\:[0-5][0-9]\:[0-5][0-9]\s+[0-9]+\sbytes/) { |
537 | $msg_q++ ; | 543 | $msg_q++ ; |
538 | } | 544 | } |
539 | } | 545 | } |
@@ -569,6 +575,7 @@ sub process_arguments(){ | |||
569 | "c=i" => \$opt_c, "critical=i" => \$opt_c, # critical if above this number | 575 | "c=i" => \$opt_c, "critical=i" => \$opt_c, # critical if above this number |
570 | "t=i" => \$opt_t, "timeout=i" => \$opt_t, | 576 | "t=i" => \$opt_t, "timeout=i" => \$opt_t, |
571 | "s" => \$opt_s, "sudo" => \$opt_s, | 577 | "s" => \$opt_s, "sudo" => \$opt_s, |
578 | "d:s" => \$opt_d, "configdir:s" => \$opt_d, | ||
572 | "W=i" => \$opt_W, # warning if above this number | 579 | "W=i" => \$opt_W, # warning if above this number |
573 | "C=i" => \$opt_C, # critical if above this number | 580 | "C=i" => \$opt_C, # critical if above this number |
574 | ); | 581 | ); |
@@ -651,7 +658,7 @@ sub process_arguments(){ | |||
651 | } | 658 | } |
652 | 659 | ||
653 | sub print_usage () { | 660 | sub print_usage () { |
654 | print "Usage: $PROGNAME -w <warn> -c <crit> [-W <warn>] [-C <crit>] [-M <MTA>] [-t <timeout>] [-s] [-v]\n"; | 661 | print "Usage: $PROGNAME -w <warn> -c <crit> [-W <warn>] [-C <crit>] [-M <MTA>] [-t <timeout>] [-s] [-d <CONFIGDIR>] [-v]\n"; |
655 | } | 662 | } |
656 | 663 | ||
657 | sub print_help () { | 664 | sub print_help () { |
@@ -669,6 +676,7 @@ sub print_help () { | |||
669 | print "-t (--timeout) = Plugin timeout in seconds (default = $utils::TIMEOUT)\n"; | 676 | print "-t (--timeout) = Plugin timeout in seconds (default = $utils::TIMEOUT)\n"; |
670 | print "-M (--mailserver) = [ sendmail | qmail | postfix | exim | nullmailer ] (default = autodetect)\n"; | 677 | print "-M (--mailserver) = [ sendmail | qmail | postfix | exim | nullmailer ] (default = autodetect)\n"; |
671 | print "-s (--sudo) = Use sudo to call the mailq command\n"; | 678 | print "-s (--sudo) = Use sudo to call the mailq command\n"; |
679 | print "-d (--configdir) = Config file or directory\n"; | ||
672 | print "-h (--help)\n"; | 680 | print "-h (--help)\n"; |
673 | print "-V (--version)\n"; | 681 | print "-V (--version)\n"; |
674 | print "-v (--verbose) = debugging output\n"; | 682 | print "-v (--verbose) = debugging output\n"; |
diff --git a/plugins-scripts/check_oracle.sh b/plugins-scripts/check_oracle.sh index 96078ac..b14ec50 100755 --- a/plugins-scripts/check_oracle.sh +++ b/plugins-scripts/check_oracle.sh | |||
@@ -8,11 +8,11 @@ | |||
8 | 8 | ||
9 | PATH="@TRUSTED_PATH@" | 9 | PATH="@TRUSTED_PATH@" |
10 | export PATH | 10 | export PATH |
11 | PROGNAME=`basename $0` | 11 | PROGNAME=$(basename "$0") |
12 | PROGPATH=`echo $0 | sed -e 's,[\\/][^\\/][^\\/]*$,,'` | 12 | PROGPATH=$(echo "$0" | sed -e 's,[\\/][^\\/][^\\/]*$,,') |
13 | REVISION="@NP_VERSION@" | 13 | REVISION="@NP_VERSION@" |
14 | 14 | ||
15 | . $PROGPATH/utils.sh | 15 | . "$PROGPATH"/utils.sh |
16 | 16 | ||
17 | 17 | ||
18 | print_usage() { | 18 | print_usage() { |
@@ -29,7 +29,7 @@ print_usage() { | |||
29 | } | 29 | } |
30 | 30 | ||
31 | print_help() { | 31 | print_help() { |
32 | print_revision $PROGNAME $REVISION | 32 | print_revision "$PROGNAME" "$REVISION" |
33 | echo "" | 33 | echo "" |
34 | print_usage | 34 | print_usage |
35 | echo "" | 35 | echo "" |
@@ -87,47 +87,47 @@ esac | |||
87 | case "$cmd" in | 87 | case "$cmd" in |
88 | --help) | 88 | --help) |
89 | print_help | 89 | print_help |
90 | exit $STATE_OK | 90 | exit "$STATE_OK" |
91 | ;; | 91 | ;; |
92 | -h) | 92 | -h) |
93 | print_help | 93 | print_help |
94 | exit $STATE_OK | 94 | exit "$STATE_OK" |
95 | ;; | 95 | ;; |
96 | --version) | 96 | --version) |
97 | print_revision $PROGNAME $REVISION | 97 | print_revision "$PROGNAME" "$REVISION" |
98 | exit $STATE_OK | 98 | exit "$STATE_OK" |
99 | ;; | 99 | ;; |
100 | -V) | 100 | -V) |
101 | print_revision $PROGNAME $REVISION | 101 | print_revision "$PROGNAME" "$REVISION" |
102 | exit $STATE_OK | 102 | exit "$STATE_OK" |
103 | ;; | 103 | ;; |
104 | esac | 104 | esac |
105 | 105 | ||
106 | # Hunt down a reasonable ORACLE_HOME | 106 | # Hunt down a reasonable ORACLE_HOME |
107 | if [ -z "$ORACLE_HOME" ] ; then | 107 | if [ -z "$ORACLE_HOME" ] ; then |
108 | # Adjust to taste | 108 | # Adjust to taste |
109 | for oratab in /var/opt/oracle/oratab /etc/oratab | 109 | for oratab in /var/opt/oracle/oratab /etc/oratab |
110 | do | 110 | do |
111 | [ ! -f $oratab ] && continue | 111 | [ ! -f $oratab ] && continue |
112 | ORACLE_HOME=`IFS=: | 112 | ORACLE_HOME=`IFS=: |
113 | while read SID ORACLE_HOME junk; | 113 | while read -r SID ORACLE_HOME junk; |
114 | do | 114 | do |
115 | if [ "$SID" = "$2" -o "$SID" = "*" ] ; then | 115 | if [ "$SID" = "$2" ] || [ "$SID" = "*" ] ; then |
116 | echo $ORACLE_HOME; | 116 | echo "$ORACLE_HOME"; |
117 | exit; | 117 | exit; |
118 | fi; | 118 | fi; |
119 | done < $oratab` | 119 | done < $oratab` |
120 | [ -n "$ORACLE_HOME" ] && break | 120 | [ -n "$ORACLE_HOME" ] && break |
121 | done | 121 | done |
122 | fi | 122 | fi |
123 | # Last resort | 123 | # Last resort |
124 | [ -z "$ORACLE_HOME" -a -d $PROGPATH/oracle ] && ORACLE_HOME=$PROGPATH/oracle | 124 | [ -z "$ORACLE_HOME" ] && [ -d "$PROGPATH"/oracle ] && ORACLE_HOME=$PROGPATH/oracle |
125 | 125 | ||
126 | if [ "$cmd" != "--db" ]; then | 126 | if [ "$cmd" != "--db" ]; then |
127 | if [ -z "$ORACLE_HOME" -o ! -d "$ORACLE_HOME" ] ; then | 127 | if [ -z "$ORACLE_HOME" ] || [ ! -d "$ORACLE_HOME" ] ; then |
128 | echo "Cannot determine ORACLE_HOME for sid $2" | 128 | echo "Cannot determine ORACLE_HOME for sid $2" |
129 | exit $STATE_UNKNOWN | 129 | exit "$STATE_UNKNOWN" |
130 | fi | 130 | fi |
131 | fi | 131 | fi |
132 | PATH=$PATH:$ORACLE_HOME/bin | 132 | PATH=$PATH:$ORACLE_HOME/bin |
133 | LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME/lib | 133 | LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ORACLE_HOME/lib |
@@ -135,81 +135,81 @@ export ORACLE_HOME PATH LD_LIBRARY_PATH | |||
135 | 135 | ||
136 | case "$cmd" in | 136 | case "$cmd" in |
137 | --tns) | 137 | --tns) |
138 | tnschk=` tnsping $2` | 138 | tnschk=$(tnsping "$2") |
139 | tnschk2=` echo $tnschk | grep -c OK` | 139 | tnschk2=$(echo "$tnschk" | grep -c OK) |
140 | if [ ${tnschk2} -eq 1 ] ; then | 140 | if [ "${tnschk2}" -eq 1 ] ; then |
141 | tnschk3=${tnschk##*(}; tnschk3=${tnschk3%)*} | 141 | tnschk3=${tnschk##*(}; tnschk3=${tnschk3%)*} |
142 | echo "OK - reply time ${tnschk3} from $2" | 142 | echo "OK - reply time ${tnschk3} from $2" |
143 | exit $STATE_OK | 143 | exit "$STATE_OK" |
144 | else | 144 | else |
145 | echo "No TNS Listener on $2" | 145 | echo "No TNS Listener on $2" |
146 | exit $STATE_CRITICAL | 146 | exit "$STATE_CRITICAL" |
147 | fi | 147 | fi |
148 | ;; | 148 | ;; |
149 | --oranames) | 149 | --oranames) |
150 | namesctl status $2 | awk ' | 150 | namesctl status "$2" | awk ' |
151 | /Server has been running for:/ { | 151 | /Server has been running for:/ { |
152 | msg = "OK: Up" | 152 | msg = "OK: Up" |
153 | for (i = 6; i <= NF; i++) { | 153 | for (i = 6; i <= NF; i++) { |
154 | msg = msg " " $i | 154 | msg = msg " " $i |
155 | } | 155 | } |
156 | status = '$STATE_OK' | 156 | status = '"$STATE_OK"' |
157 | } | 157 | } |
158 | /error/ { | 158 | /error/ { |
159 | msg = "CRITICAL: " $0 | 159 | msg = "CRITICAL: " $0 |
160 | status = '$STATE_CRITICAL' | 160 | status = '"$STATE_CRITICAL"' |
161 | } | 161 | } |
162 | END { | 162 | END { |
163 | print msg | 163 | print msg |
164 | exit status | 164 | exit status |
165 | }' | 165 | }' |
166 | ;; | 166 | ;; |
167 | --db) | 167 | --db) |
168 | pmonchk=`ps -ef | grep -v grep | grep -E -c "(asm|ora)_pmon_${2}$"` | 168 | pmonchk=$(pgrep -f "(asm|ora)_pmon_${2}$") |
169 | if [ ${pmonchk} -ge 1 ] ; then | 169 | if [ "${pmonchk}" -ge 1 ] ; then |
170 | echo "${2} OK - ${pmonchk} PMON process(es) running" | 170 | echo "${2} OK - ${pmonchk} PMON process(es) running" |
171 | exit $STATE_OK | 171 | exit "$STATE_OK" |
172 | #if [ -f $ORACLE_HOME/dbs/sga*${2}* ] ; then | 172 | #if [ -f $ORACLE_HOME/dbs/sga*${2}* ] ; then |
173 | #if [ ${pmonchk} -eq 1 ] ; then | 173 | #if [ ${pmonchk} -eq 1 ] ; then |
174 | #utime=`ls -la $ORACLE_HOME/dbs/sga*$2* | cut -c 43-55` | 174 | #utime=`ls -la $ORACLE_HOME/dbs/sga*$2* | cut -c 43-55` |
175 | #echo "${2} OK - running since ${utime}" | 175 | #echo "${2} OK - running since ${utime}" |
176 | #exit $STATE_OK | 176 | #exit $STATE_OK |
177 | #fi | 177 | #fi |
178 | else | 178 | else |
179 | echo "${2} Database is DOWN" | 179 | echo "${2} Database is DOWN" |
180 | exit $STATE_CRITICAL | 180 | exit "$STATE_CRITICAL" |
181 | fi | 181 | fi |
182 | ;; | 182 | ;; |
183 | --login) | 183 | --login) |
184 | loginchk=`sqlplus dummy/user@$2 < /dev/null` | 184 | loginchk=$(sqlplus dummy/user@"$2" < /dev/null) |
185 | loginchk2=` echo $loginchk | grep -c ORA-01017` | 185 | loginchk2=$(echo "$loginchk" | grep -c ORA-01017) |
186 | if [ ${loginchk2} -eq 1 ] ; then | 186 | if [ "${loginchk2}" -eq 1 ] ; then |
187 | echo "OK - dummy login connected" | 187 | echo "OK - dummy login connected" |
188 | exit $STATE_OK | 188 | exit "$STATE_OK" |
189 | else | 189 | else |
190 | loginchk3=` echo "$loginchk" | grep "ORA-" | head -1` | 190 | loginchk3=$(echo "$loginchk" | grep "ORA-" | head -1) |
191 | echo "CRITICAL - $loginchk3" | 191 | echo "CRITICAL - $loginchk3" |
192 | exit $STATE_CRITICAL | 192 | exit "$STATE_CRITICAL" |
193 | fi | 193 | fi |
194 | ;; | 194 | ;; |
195 | --connect) | 195 | --connect) |
196 | connectchk=`sqlplus $2 < /dev/null` | 196 | connectchk=$(sqlplus "$2" < /dev/null) |
197 | connectchk2=` echo $connectchk | grep -c ORA-` | 197 | connectchk2=$(echo "$connectchk" | grep -c ORA-) |
198 | if [ ${connectchk2} -eq 0 ] ; then | 198 | if [ "${connectchk2}" -eq 0 ] ; then |
199 | echo "OK - login successful" | 199 | echo "OK - login successful" |
200 | exit $STATE_OK | 200 | exit "$STATE_OK" |
201 | else | 201 | else |
202 | connectchk3=` echo "$connectchk" | grep "ORA-" | head -1` | 202 | connectchk3=$(echo "$connectchk" | grep "ORA-" | head -1) |
203 | echo "CRITICAL - $connectchk3" | 203 | echo "CRITICAL - $connectchk3" |
204 | exit $STATE_CRITICAL | 204 | exit "$STATE_CRITICAL" |
205 | fi | 205 | fi |
206 | ;; | 206 | ;; |
207 | --cache) | 207 | --cache) |
208 | if [ ${5} -gt ${6} ] ; then | 208 | if [ "${5}" -gt "${6}" ] ; then |
209 | echo "UNKNOWN - Warning level is less then Crit" | 209 | echo "UNKNOWN - Warning level is less then Crit" |
210 | exit $STATE_UNKNOWN | 210 | exit "$STATE_UNKNOWN" |
211 | fi | 211 | fi |
212 | result=`sqlplus -s ${3}/${4}@${2} << EOF | 212 | result=`sqlplus -s "${3}"/"${4}"@"${2}" << EOF |
213 | set pagesize 0 | 213 | set pagesize 0 |
214 | set numf '9999999.99' | 214 | set numf '9999999.99' |
215 | select (1-(pr.value/(dbg.value+cg.value)))*100 | 215 | select (1-(pr.value/(dbg.value+cg.value)))*100 |
@@ -219,48 +219,48 @@ and dbg.name='db block gets' | |||
219 | and cg.name='consistent gets'; | 219 | and cg.name='consistent gets'; |
220 | EOF` | 220 | EOF` |
221 | 221 | ||
222 | if [ -n "`echo $result | grep ORA-`" ] ; then | 222 | if echo "$result" | grep -q 'ORA-' ; then |
223 | error=` echo "$result" | grep "ORA-" | head -1` | 223 | error=$(echo "$result" | grep "ORA-" | head -1) |
224 | echo "CRITICAL - $error" | 224 | echo "CRITICAL - $error" |
225 | exit $STATE_CRITICAL | 225 | exit "$STATE_CRITICAL" |
226 | fi | 226 | fi |
227 | 227 | ||
228 | buf_hr=`echo "$result" | awk '/^[0-9\. \t]+$/ {print int($1)}'` | 228 | buf_hr=$(echo "$result" | awk '/^[0-9\. \t]+$/ {print int($1)}') |
229 | buf_hrx=`echo "$result" | awk '/^[0-9\. \t]+$/ {print $1}'` | 229 | buf_hrx=$(echo "$result" | awk '/^[0-9\. \t]+$/ {print $1}') |
230 | result=`sqlplus -s ${3}/${4}@${2} << EOF | 230 | result=`sqlplus -s "${3}"/"${4}"@"${2}" << EOF |
231 | set pagesize 0 | 231 | set pagesize 0 |
232 | set numf '9999999.99' | 232 | set numf '9999999.99' |
233 | select sum(lc.pins)/(sum(lc.pins)+sum(lc.reloads))*100 | 233 | select sum(lc.pins)/(sum(lc.pins)+sum(lc.reloads))*100 |
234 | from v\\$librarycache lc; | 234 | from v\\$librarycache lc; |
235 | EOF` | 235 | EOF` |
236 | 236 | ||
237 | if [ -n "`echo $result | grep ORA-`" ] ; then | 237 | if echo "$result" | grep -q 'ORA-' ; then |
238 | error=` echo "$result" | grep "ORA-" | head -1` | 238 | error=$(echo "$result" | grep "ORA-" | head -1) |
239 | echo "CRITICAL - $error" | 239 | echo "CRITICAL - $error" |
240 | exit $STATE_CRITICAL | 240 | exit "$STATE_CRITICAL" |
241 | fi | 241 | fi |
242 | 242 | ||
243 | lib_hr=`echo "$result" | awk '/^[0-9\. \t]+$/ {print int($1)}'` | 243 | lib_hr=$(echo "$result" | awk '/^[0-9\. \t]+$/ {print int($1)}') |
244 | lib_hrx=`echo "$result" | awk '/^[0-9\. \t]+$/ {print $1}'` | 244 | lib_hrx=$(echo "$result" | awk '/^[0-9\. \t]+$/ {print $1}') |
245 | 245 | ||
246 | if [ $buf_hr -le ${5} -o $lib_hr -le ${5} ] ; then | 246 | if [ "$buf_hr" -le "${5}" ] || [ "$lib_hr" -le "${5}" ] ; then |
247 | echo "${2} CRITICAL - Cache Hit Rates: $lib_hrx% Lib -- $buf_hrx% Buff|lib=$lib_hrx%;${6};${5};0;100 buffer=$buf_hrx%;${6};${5};0;100" | 247 | echo "${2} CRITICAL - Cache Hit Rates: $lib_hrx% Lib -- $buf_hrx% Buff|lib=$lib_hrx%;${6};${5};0;100 buffer=$buf_hrx%;${6};${5};0;100" |
248 | exit $STATE_CRITICAL | 248 | exit "$STATE_CRITICAL" |
249 | fi | 249 | fi |
250 | if [ $buf_hr -le ${6} -o $lib_hr -le ${6} ] ; then | 250 | if [ "$buf_hr" -le "${6}" ] || [ "$lib_hr" -le "${6}" ] ; then |
251 | echo "${2} WARNING - Cache Hit Rates: $lib_hrx% Lib -- $buf_hrx% Buff|lib=$lib_hrx%;${6};${5};0;100 buffer=$buf_hrx%;${6};${5};0;100" | 251 | echo "${2} WARNING - Cache Hit Rates: $lib_hrx% Lib -- $buf_hrx% Buff|lib=$lib_hrx%;${6};${5};0;100 buffer=$buf_hrx%;${6};${5};0;100" |
252 | exit $STATE_WARNING | 252 | exit "$STATE_WARNING" |
253 | fi | 253 | fi |
254 | echo "${2} OK - Cache Hit Rates: $lib_hrx% Lib -- $buf_hrx% Buff|lib=$lib_hrx%;${6};${5};0;100 buffer=$buf_hrx%;${6};${5};0;100" | 254 | echo "${2} OK - Cache Hit Rates: $lib_hrx% Lib -- $buf_hrx% Buff|lib=$lib_hrx%;${6};${5};0;100 buffer=$buf_hrx%;${6};${5};0;100" |
255 | 255 | ||
256 | exit $STATE_OK | 256 | exit "$STATE_OK" |
257 | ;; | 257 | ;; |
258 | --tablespace) | 258 | --tablespace) |
259 | if [ ${6} -lt ${7} ] ; then | 259 | if [ "${6}" -lt "${7}" ] ; then |
260 | echo "UNKNOWN - Warning level is more then Crit" | 260 | echo "UNKNOWN - Warning level is more then Crit" |
261 | exit $STATE_UNKNOWN | 261 | exit "$STATE_UNKNOWN" |
262 | fi | 262 | fi |
263 | result=`sqlplus -s ${3}/${4}@${2} << EOF | 263 | result=`sqlplus -s "${3}"/"${4}"@"${2}" << EOF |
264 | set pagesize 0 | 264 | set pagesize 0 |
265 | set numf '9999999.99' | 265 | set numf '9999999.99' |
266 | select NVL(b.free,0.0),a.total,100 - trunc(NVL(b.free,0.0)/a.total * 1000) / 10 prc | 266 | select NVL(b.free,0.0),a.total,100 - trunc(NVL(b.free,0.0)/a.total * 1000) / 10 prc |
@@ -273,32 +273,32 @@ from dba_free_space group by tablespace_name) B | |||
273 | ON a.tablespace_name=b.tablespace_name WHERE a.tablespace_name='${5}'; | 273 | ON a.tablespace_name=b.tablespace_name WHERE a.tablespace_name='${5}'; |
274 | EOF` | 274 | EOF` |
275 | 275 | ||
276 | if [ -n "`echo $result | grep ORA-`" ] ; then | 276 | if echo "$result" | grep -q 'ORA-' ; then |
277 | error=` echo "$result" | grep "ORA-" | head -1` | 277 | error=$(echo "$result" | grep "ORA-" | head -1) |
278 | echo "CRITICAL - $error" | 278 | echo "CRITICAL - $error" |
279 | exit $STATE_CRITICAL | 279 | exit "$STATE_CRITICAL" |
280 | fi | 280 | fi |
281 | 281 | ||
282 | ts_free=`echo "$result" | awk '/^[ 0-9\.\t ]+$/ {print int($1)}'` | 282 | ts_free=$(echo "$result" | awk '/^[ 0-9\.\t ]+$/ {print int($1)}') |
283 | ts_total=`echo "$result" | awk '/^[ 0-9\.\t ]+$/ {print int($2)}'` | 283 | ts_total=$(echo "$result" | awk '/^[ 0-9\.\t ]+$/ {print int($2)}') |
284 | ts_pct=`echo "$result" | awk '/^[ 0-9\.\t ]+$/ {print int($3)}'` | 284 | ts_pct=$(echo "$result" | awk '/^[ 0-9\.\t ]+$/ {print int($3)}') |
285 | ts_pctx=`echo "$result" | awk '/^[ 0-9\.\t ]+$/ {print $3}'` | 285 | ts_pctx=$(echo "$result" | awk '/^[ 0-9\.\t ]+$/ {print $3}') |
286 | if [ "$ts_free" -eq 0 -a "$ts_total" -eq 0 -a "$ts_pct" -eq 0 ] ; then | 286 | if [ "$ts_free" -eq 0 ] && [ "$ts_total" -eq 0 ] && [ "$ts_pct" -eq 0 ] ; then |
287 | echo "No data returned by Oracle - tablespace $5 not found?" | 287 | echo "No data returned by Oracle - tablespace $5 not found?" |
288 | exit $STATE_UNKNOWN | 288 | exit "$STATE_UNKNOWN" |
289 | fi | 289 | fi |
290 | if [ "$ts_pct" -ge ${6} ] ; then | 290 | if [ "$ts_pct" -ge "${6}" ] ; then |
291 | echo "${2} : ${5} CRITICAL - $ts_pctx% used [ $ts_free / $ts_total MB available ]|${5}=$ts_pctx%;${7};${6};0;100" | 291 | echo "${2} : ${5} CRITICAL - $ts_pctx% used [ $ts_free / $ts_total MB available ]|${5}=$ts_pctx%;${7};${6};0;100" |
292 | exit $STATE_CRITICAL | 292 | exit "$STATE_CRITICAL" |
293 | fi | 293 | fi |
294 | if [ "$ts_pct" -ge ${7} ] ; then | 294 | if [ "$ts_pct" -ge "${7}" ] ; then |
295 | echo "${2} : ${5} WARNING - $ts_pctx% used [ $ts_free / $ts_total MB available ]|${5}=$ts_pctx%;${7};${6};0;100" | 295 | echo "${2} : ${5} WARNING - $ts_pctx% used [ $ts_free / $ts_total MB available ]|${5}=$ts_pctx%;${7};${6};0;100" |
296 | exit $STATE_WARNING | 296 | exit "$STATE_WARNING" |
297 | fi | 297 | fi |
298 | echo "${2} : ${5} OK - $ts_pctx% used [ $ts_free / $ts_total MB available ]|${5}=$ts_pctx%;${7};${6};0;100" | 298 | echo "${2} : ${5} OK - $ts_pctx% used [ $ts_free / $ts_total MB available ]|${5}=$ts_pctx%;${7};${6};0;100" |
299 | exit $STATE_OK | 299 | exit "$STATE_OK" |
300 | ;; | 300 | ;; |
301 | *) | 301 | *) |
302 | print_usage | 302 | print_usage |
303 | exit $STATE_UNKNOWN | 303 | exit "$STATE_UNKNOWN" |
304 | esac | 304 | esac |
diff --git a/plugins-scripts/check_sensors.sh b/plugins-scripts/check_sensors.sh index f742830..9a6cf5d 100755 --- a/plugins-scripts/check_sensors.sh +++ b/plugins-scripts/check_sensors.sh | |||
@@ -2,46 +2,46 @@ | |||
2 | 2 | ||
3 | PATH="@TRUSTED_PATH@" | 3 | PATH="@TRUSTED_PATH@" |
4 | export PATH | 4 | export PATH |
5 | PROGNAME=`basename $0` | 5 | PROGNAME=$(basename "$0") |
6 | PROGPATH=`echo $0 | sed -e 's,[\\/][^\\/][^\\/]*$,,'` | 6 | PROGPATH=$(echo "$0" | sed -e 's,[\\/][^\\/][^\\/]*$,,') |
7 | REVISION="@NP_VERSION@" | 7 | REVISION="@NP_VERSION@" |
8 | 8 | ||
9 | . $PROGPATH/utils.sh | 9 | . "$PROGPATH"/utils.sh |
10 | 10 | ||
11 | print_usage() { | 11 | print_usage() { |
12 | echo "Usage: $PROGNAME" [--ignore-fault] | 12 | echo "Usage: $PROGNAME" [--ignore-fault] |
13 | } | 13 | } |
14 | 14 | ||
15 | print_help() { | 15 | print_help() { |
16 | print_revision $PROGNAME $REVISION | 16 | print_revision "$PROGNAME" "$REVISION" |
17 | echo "" | 17 | echo "" |
18 | print_usage | 18 | print_usage |
19 | echo "" | 19 | echo "" |
20 | echo "This plugin checks hardware status using the lm_sensors package." | 20 | echo "This plugin checks hardware status using the lm_sensors package." |
21 | echo "" | 21 | echo "" |
22 | support | 22 | support |
23 | exit $STATE_OK | 23 | exit "$STATE_OK" |
24 | } | 24 | } |
25 | 25 | ||
26 | case "$1" in | 26 | case "$1" in |
27 | --help) | 27 | --help) |
28 | print_help | 28 | print_help |
29 | exit $STATE_OK | 29 | exit "$STATE_OK" |
30 | ;; | 30 | ;; |
31 | -h) | 31 | -h) |
32 | print_help | 32 | print_help |
33 | exit $STATE_OK | 33 | exit "$STATE_OK" |
34 | ;; | 34 | ;; |
35 | --version) | 35 | --version) |
36 | print_revision $PROGNAME $REVISION | 36 | print_revision "$PROGNAME" "$REVISION" |
37 | exit $STATE_OK | 37 | exit "$STATE_OK" |
38 | ;; | 38 | ;; |
39 | -V) | 39 | -V) |
40 | print_revision $PROGNAME $REVISION | 40 | print_revision "$PROGNAME" "$REVISION" |
41 | exit $STATE_OK | 41 | exit "$STATE_OK" |
42 | ;; | 42 | ;; |
43 | *) | 43 | *) |
44 | sensordata=`sensors 2>&1` | 44 | sensordata=$(sensors 2>&1) |
45 | status=$? | 45 | status=$? |
46 | if test ${status} -eq 127; then | 46 | if test ${status} -eq 127; then |
47 | text="SENSORS UNKNOWN - command not found (did you install lmsensors?)" | 47 | text="SENSORS UNKNOWN - command not found (did you install lmsensors?)" |
@@ -49,10 +49,10 @@ case "$1" in | |||
49 | elif test ${status} -ne 0; then | 49 | elif test ${status} -ne 0; then |
50 | text="WARNING - sensors returned state $status" | 50 | text="WARNING - sensors returned state $status" |
51 | exit=$STATE_WARNING | 51 | exit=$STATE_WARNING |
52 | elif echo ${sensordata} | egrep ALARM > /dev/null; then | 52 | elif echo "${sensordata}" | egrep ALARM > /dev/null; then |
53 | text="SENSOR CRITICAL - Sensor alarm detected!" | 53 | text="SENSOR CRITICAL - Sensor alarm detected!" |
54 | exit=$STATE_CRITICAL | 54 | exit=$STATE_CRITICAL |
55 | elif echo ${sensordata} | egrep FAULT > /dev/null \ | 55 | elif echo "${sensordata}" | egrep FAULT > /dev/null \ |
56 | && test "$1" != "-i" -a "$1" != "--ignore-fault"; then | 56 | && test "$1" != "-i" -a "$1" != "--ignore-fault"; then |
57 | text="SENSOR UNKNOWN - Sensor reported fault" | 57 | text="SENSOR UNKNOWN - Sensor reported fault" |
58 | exit=$STATE_UNKNOWN | 58 | exit=$STATE_UNKNOWN |
@@ -63,8 +63,8 @@ case "$1" in | |||
63 | 63 | ||
64 | echo "$text" | 64 | echo "$text" |
65 | if test "$1" = "-v" -o "$1" = "--verbose"; then | 65 | if test "$1" = "-v" -o "$1" = "--verbose"; then |
66 | echo ${sensordata} | 66 | echo "${sensordata}" |
67 | fi | 67 | fi |
68 | exit $exit | 68 | exit "$exit" |
69 | ;; | 69 | ;; |
70 | esac | 70 | esac |