projects
/
zfs-ubuntu
/
.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
e868864
)
Fixed bug when parsing filesystems that have no data on a given date.
author
Alan J. Pippin
<ajp@pippins.net>
Wed, 12 Mar 2008 16:14:46 +0000
(10:14 -0600)
committer
Alan J. Pippin
<ajp@pippins.net>
Wed, 12 Mar 2008 16:14:46 +0000
(10:14 -0600)
zfs-log-parser
patch
|
blob
|
history
diff --git
a/zfs-log-parser
b/zfs-log-parser
index dbb3c15a88a8e533a05ad30593c35755d84a0c7b..f3619dbe912fc5caf4e13184119905a8304a37c8 100755
(executable)
--- a/
zfs-log-parser
+++ b/
zfs-log-parser
@@
-107,9
+107,9
@@
sub parse_snapshot_totals_logfile {
elsif(($in_totals == 1) && ($line =~ /^\s+$/)) {
$in_totals = 0;
}
elsif(($in_totals == 1) && ($line =~ /^\s+$/)) {
$in_totals = 0;
}
- elsif(($in_totals == 1) && ($line =~ /(\S+)\s+([\d\.]
+
)(\w+)\s+(\d+)/)) {
+ elsif(($in_totals == 1) && ($line =~ /(\S+)\s+([\d\.]
*
)(\w+)\s+(\d+)/)) {
$filesystem = $1; $data = $2; $size = $3; $num_snaps = $4;
$filesystem = $1; $data = $2; $size = $3; $num_snaps = $4;
- if($filesystem =~ /Snapshots/) { next; }
+ if($filesystem =~ /Snapshots/
|| $filesystem =~ /Total/
) { next; }
if($filesystem =~ /$backup_pool/) { next; }
if(length($filesystem) > $maxlen) { $maxlen = length($filesystem); }
if($size =~ /K/i) { $data = $data * $kilo; }
if($filesystem =~ /$backup_pool/) { next; }
if(length($filesystem) > $maxlen) { $maxlen = length($filesystem); }
if($size =~ /K/i) { $data = $data * $kilo; }
@@
-129,6
+129,7
@@
sub parse_snapshot_totals_logfile {
foreach $date (sort keys %$hashref) {
if($date !~ /(\d+)-(\d+)-(\d+)/) { next; }
$date_data=adjust_data($totals{$filesystem}{$date}{data});
foreach $date (sort keys %$hashref) {
if($date !~ /(\d+)-(\d+)-(\d+)/) { next; }
$date_data=adjust_data($totals{$filesystem}{$date}{data});
+ if($date_data eq "") { $date_data = "0"; }
$data .= sprintf("%10s",$date_data). " ";
$date_totals{$date}{data} += $totals{$filesystem}{$date}{data};
}
$data .= sprintf("%10s",$date_data). " ";
$date_totals{$date}{data} += $totals{$filesystem}{$date}{data};
}