Skip to content
Snippets Groups Projects
Commit 43512d3f authored by Sergey Joseph Ivanov's avatar Sergey Joseph Ivanov
Browse files

new output for zol

parent f024accb
No related branches found
No related tags found
Loading
......@@ -94,6 +94,15 @@ sub handler {
scan: scrub in progress since Tue Mar 29 19:09:47 2016
14.3G scanned out of 47.0G at 172M/s, 0h3m to go
0 repaired, 30.42% done
- or -
scan: resilver in progress since Fri Aug 7 14:07:30 2020
451G scanned at 2.17G/s, 2.13M issued at 10.5K/s, 19.6T total
0B resilvered, 0.00% done, no estimated completion time
- or -
scan: resilver in progress since Fri Aug 7 14:07:30 2020
855G scanned at 188M/s, 227G issued at 49.9M/s, 19.6T total
228G resilvered, 1.13% done, 4 days 17:00:28 to go
=cut
my ($when,$days,$h,$m,$s,$howlong,$togo,$repaired,$errors,$canceled)=(0,0,0,0,0,0,0,0);
my $STATUSCMD = "/usr/sbin/zpool status $zpool";
......@@ -127,18 +136,30 @@ sub handler {
$togo = 0;
`$ECHO -n $howlong > $statusfile` unless $howlong == $oldhowlong && (-w $statusfile);
}
elsif (/^\s*scan:\s+scrub\s+in\s+progress\s+since\s+(.+)$/){
elsif ( (/^\s*scan:\s+scrub\s+in\s+progress\s+since\s+(.+)$/) or
(/^\s*scan:\s+resilver\s+in\s+progress\s+since\s+(.+)$/)
){
$when = $1;
$when = `$DATE '+%s'` - `$DATE '+%s' -d "$when"`;
$when += 30;
$when /= 60;
$when = int($when);
}
elsif (/^\s*\S+\s+scanned\s+out\s+of\s+\S+\s+at\s+\S+,\s+(\d+)h(\d+)m\s+to\s+go\s*$/){
elsif ( (/^\s*\S+\s+scanned.*,\s+(\d+)h(\d+)m\s+to\s+go\s*$/) or
(/^\s*\S+\s+resilvered.*,\s+(\d+)h(\d+)m\s+to\s+go\s*$/)
){
$togo = $1*60 +$2;
$howlong = $oldhowlong;
}
elsif (/^\s*(\d+)\s+repaired,/){
elsif ( (/^\s*\S+\s+scanned.*,\s+(\d+)\s+days\s+(\d+):(\d+):(\d+)\s+to\s+go\s*$/) or
(/^\s*\S+\s+resilvered.*,\s+(\d+)\s+days\s+(\d+):(\d+):(\d+)\s+to\s+go\s*$/)
){
$togo = ($1*24 + $2)*60 +$3;
$howlong = $oldhowlong;
}
elsif ( (/^\s*(\d+)\s+repaired,/) or
(/^\s*(\d+)\s+resilvered,/)
){
$repaired = $1;
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment