Skip to content

Commit

Permalink
Merge pull request jimsalterjrs#259 from phreaker0/vdev-errors
Browse files Browse the repository at this point in the history
 let monitor-health check vdev members for io/checksum errors
  • Loading branch information
jimsalterjrs authored Sep 3, 2018
2 parents 68f174e + 997487d commit 22160de
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions sanoid
Original file line number Diff line number Diff line change
Expand Up @@ -974,7 +974,7 @@ sub check_zpool() {
}
## other cases
my ($dev, $sta) = /^\s+(\S+)\s+(\S+)/;
my ($dev, $sta, $read, $write, $cksum) = /^\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)/;
if (!defined($sta)) {
# cache and logs are special and don't have a status
Expand All @@ -994,8 +994,21 @@ sub check_zpool() {
## no display for verbose level 1
next if ($verbose==1);
## don't display working devices for verbose level 2
next if ($verbose==2 && $state eq "OK");
next if ($verbose==2 && ($sta eq "ONLINE" || $sta eq "AVAIL" || $sta eq "INUSE"));
if ($verbose==2 && ($state eq "OK" || $sta eq "ONLINE" || $sta eq "AVAIL" || $sta eq "INUSE")) {
# check for io/checksum errors
my @vdeverr = ();
if ($read != 0) { push @vdeverr, "read" };
if ($write != 0) { push @vdeverr, "write" };
if ($cksum != 0) { push @vdeverr, "cksum" };
if (scalar @vdeverr) {
$dmge=$dmge . "(" . $dev . ":" . join(", ", @vdeverr) . " errors) ";
if ($state eq "OK") { $state = "WARNING" };
}
next;
}
## show everything else
if (/^\s{3}(\S+)/) {
Expand Down

0 comments on commit 22160de

Please sign in to comment.