# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
use strict;
+use English;
+use Getopt::Long;
# nagios exit codes
my %CODE = (
};
}
+my $usage = "$PROGRAM_NAME: Usage: $PROGRAM_NAME [--ignore-transfer-speed=<pd> [--ignore-transfer-speed=<pd> ...]]\n";
+my $params;
+Getopt::Long::Configure('bundling');
+if (!GetOptions (
+ '--help' => \$params->{'help'},
+ '--ignore-transfer-speed=s@' => \$params->{'ignore-transfer-speed'},
+ )) {
+ die ($usage);
+};
+if ($params->{'help'}) {
+ print $usage;
+ exit (0);
+};
+die ($usage) unless (scalar @ARGV == 0);
my $ctrlallshow = runcmd("controller all show");
my @controllers;
$type = 'SCSI';
} elsif ($drive =~ /^[0-9]+[EI]:[0-9]+:[0-9]+$/) { # SAS
$type = 'SAS';
+ } elsif ($drive =~ /^[0-9]+[C]:[0-9]+:[0-9]+$/) { # New 6GBPS SAS
+ $type = 'SAS+';
} else {
# I'm not going to run pass arguments of unknown form to the shell..
warn ("Unknown diskdrive ID $drive\n");
} elsif ($type eq 'SAS') {
$key = 'PHY Transfer Rate';
if ($value{'PHY Count'} eq '2') {
- $expected = '3.0GBPS, Unknown';
+ if (defined($value{'Redundant Path(s)'})) {
+ $expected = '3.0GBPS, 3.0GBPS';
+ } else {
+ $expected = [ '3.0GBPS, Unknown', 'Unknown, 3.0GBPS' ];
+ }
} else {
$expected = '3.0GBPS';
}
+ } elsif ($type eq 'SAS+') {
+ $key = 'PHY Transfer Rate';
+ if ($value{'PHY Count'} eq '2') {
+ $expected = '6.0GBPS, Unknown';
+ } else {
+ $expected = '6.0GBPS';
+ }
} else {
warn "Should not be here. Do not know what to do with type '$type'\n";
next;
}
+ if (exists $params->{'ignore-transfer-speed'}) {
+ if (grep { $drive eq $_ } @{$params->{'ignore-transfer-speed'}}) {
+ push @{$status{'ignored transfer speed'}}, $drive."(".$value{$key}.")";
+ };
+ next;
+ };
if (!defined $value{$key}) {
record('WARNING');
push @{$status{'unknown transfer speed'}}, $drive;
+ } elsif (ref($expected) eq 'ARRAY') {
+ if (scalar(grep { $value{$key} eq $_ } @$expected) == 0) {
+ record('WARNING');
+ push @{$status{'bad transfer speed'}}, $drive."(".$value{$key}.")";
+ };
} elsif ($value{$key} ne $expected) {
record('WARNING');
push @{$status{'bad transfer speed'}}, $drive."(".$value{$key}.")";