projects
/
mirror
/
dsa-nagios.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
remove it even more
[mirror/dsa-nagios.git]
/
dsa-nagios-checks
/
checks
/
dsa-check-hpacucli
diff --git
a/dsa-nagios-checks/checks/dsa-check-hpacucli
b/dsa-nagios-checks/checks/dsa-check-hpacucli
index
3d30816
..
8bbb7eb
100755
(executable)
--- a/
dsa-nagios-checks/checks/dsa-check-hpacucli
+++ b/
dsa-nagios-checks/checks/dsa-check-hpacucli
@@
-5,7
+5,7
@@
#
# does _not_ check raid status. use arrayprobe for that.
#
# does _not_ check raid status. use arrayprobe for that.
-# Copyright (c) 2008,2009 Peter Palfrader <peter@palfrader.org>
+# Copyright (c) 2008,2009
,2010,2011
Peter Palfrader <peter@palfrader.org>
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
@@
-41,7
+41,7
@@
my %CODE = (
my $EXITCODE = 'OK';
$SIG{'__DIE__'} = sub {
my $EXITCODE = 'OK';
$SIG{'__DIE__'} = sub {
- print
STDERR
@_;
+ print @_;
exit $CODE{'UNKNOWN'};
};
exit $CODE{'UNKNOWN'};
};
@@
-64,11
+64,14
@@
sub record($) {
};
}
};
}
-my $usage = "$PROGRAM_NAME: Usage: $PROGRAM_NAME [--ignore-transfer-speed=<pd> [--ignore-transfer-speed=<pd> ...]]\n";
+my $usage = "$PROGRAM_NAME: Usage: $PROGRAM_NAME [--
no-battery] [--ignore-controller=<regex>] [--no-controller-ok] [--
ignore-transfer-speed=<pd> [--ignore-transfer-speed=<pd> ...]]\n";
my $params;
Getopt::Long::Configure('bundling');
if (!GetOptions (
'--help' => \$params->{'help'},
my $params;
Getopt::Long::Configure('bundling');
if (!GetOptions (
'--help' => \$params->{'help'},
+ '--no-battery' => \$params->{'no-battery'},
+ '--no-controller-ok' => \$params->{'no-controller-ok'},
+ '--ignore-controller=s' => \$params->{'ignore-controller'},
'--ignore-transfer-speed=s@' => \$params->{'ignore-transfer-speed'},
)) {
die ($usage);
'--ignore-transfer-speed=s@' => \$params->{'ignore-transfer-speed'},
)) {
die ($usage);
@@
-84,6
+87,7
@@
my @controllers;
for (@$ctrlallshow) {
chomp;
next if /^$/;
for (@$ctrlallshow) {
chomp;
next if /^$/;
+ next if ($params->{'ignore-controller'} && /$params->{'ignore-controller'}/);
if (/in Slot ([0-9a-z]+)/) {
push @controllers, $1;
next;
if (/in Slot ([0-9a-z]+)/) {
push @controllers, $1;
next;
@@
-92,8
+96,13
@@
for (@$ctrlallshow) {
};
if (scalar @controllers == 0) {
};
if (scalar @controllers == 0) {
- print "UNKNONW: No smartarray controllers found with hpacucli\n";
- exit $CODE{'UNKNOWN'}
+ if ($params->{'no-controller-ok'}) {
+ print "No smartarray controllers found with hpacucli\n";
+ exit $CODE{'OK'}
+ } else {
+ print "UNKNOWN: No smartarray controllers found with hpacucli\n";
+ exit $CODE{'UNKNOWN'}
+ }
};
my @resultstr;
};
my @resultstr;
@@
-207,11
+216,11
@@
for my $slot (sort @controllers) {
record('WARNING');
push @{$status{'unknown transfer speed'}}, $drive;
} elsif (ref($expected) eq 'ARRAY') {
record('WARNING');
push @{$status{'unknown transfer speed'}}, $drive;
} elsif (ref($expected) eq 'ARRAY') {
- if (scalar(grep {
$value{$key} eq $_
} @$expected) == 0) {
+ if (scalar(grep {
uc($value{$key}) eq uc($_)
} @$expected) == 0) {
record('WARNING');
push @{$status{'bad transfer speed'}}, $drive."(".$value{$key}.")";
};
record('WARNING');
push @{$status{'bad transfer speed'}}, $drive."(".$value{$key}.")";
};
- } elsif (
$value{$key} ne $expected
) {
+ } elsif (
uc($value{$key}) ne uc($expected)
) {
record('WARNING');
push @{$status{'bad transfer speed'}}, $drive."(".$value{$key}.")";
};
record('WARNING');
push @{$status{'bad transfer speed'}}, $drive."(".$value{$key}.")";
};
@@
-236,6
+245,8
@@
for my $slot (sort @controllers) {
my $status = $2;
push @{$status{$status}}, $system;
if ($status ne 'OK') {
my $status = $2;
push @{$status{$status}}, $system;
if ($status ne 'OK') {
+ next if ($params->{'no-battery'} && $system eq 'Cache');
+ next if ($params->{'no-battery'} && $system eq 'Battery/Capacitor');
record('WARNING');
};
} else {
record('WARNING');
};
} else {