#!/usr/bin/perl -w
-# check _physical_ disk status of disks on HP smart array controllers
-# requires hpssacli
+# check _physical_ disk status of disks on Smart Array controllers
+# requires hpssacli or ssacli
#
# does _not_ check raid status. use arrayprobe for that.
exit $CODE{'UNKNOWN'};
};
+# support both the older hpssacli and the newer ssacli
+my $BIN;
+if ($0 =~ /hpssacli/) {
+ $BIN = "hpssacli";
+} else {
+ $BIN = "ssacli";
+}
+
sub runcmd($) {
my ($cmd) = @_;
- $cmd = "sudo hpssacli $cmd";
+ $cmd = "sudo $BIN $cmd";
open(FH, $cmd."|") or die ("Cannot run $cmd: $!");
my @lines = <FH>;
close FH;
if (scalar keys %controllers == 0) {
if ($params->{'no-controller-ok'}) {
- print "No smartarray controllers found with hpssacli\n";
+ print "No Smart Array controllers found with $BIN\n";
exit $CODE{'OK'}
} else {
- print "UNKNOWN: No smartarray controllers found with hpssacli\n";
+ print "UNKNOWN: No Smart Array controllers found with $BIN\n";
exit $CODE{'UNKNOWN'}
}
};
chomp;
next if /^$/;
next if (/^\S.*in Slot $slot/);
- next if /^ *array [A-Z]$/;
+ next if /^ *Array [A-Z]$/i;
next if /^ *unassigned/;
if (/^ *HBA Drives/) {
# HBA mode implies no logical drives, thus reset the "drives found" check and proceed with
$nodrives = 0;
next;
}
- if (/^ *(array [A-Z]) \(Failed\)$/) {
+ if (/^ *(Array [A-Z]) \(Failed\)$/i) {
record('CRITICAL');
push @{$status{'Failed'}}, $1;
} elsif (/^Error: The specified controller does not have any physical drives on it.$/) {
} elsif (defined $drive && m/^\s*(.*?):\s*(.*?)\s*$/) {
$drives{$drive}{$1} = $2;
} else {
- die ("Cannot read line '$_' gotten from hpssacli controller slot=$slot pd all show\n");
+ die ("Cannot read line '$_' gotten from $BIN controller slot=$slot pd all show\n");
}
};