From: Alan J. Pippin Date: Wed, 12 Mar 2008 16:14:46 +0000 (-0600) Subject: Fixed bug when parsing filesystems that have no data on a given date. X-Git-Url: http://git.pippins.net/embedvideo/.git/%22%22.%24thumbnail.%22/static/%3C?a=commitdiff_plain;h=20a696fe558ae539023864c047543bb2e0e9f1a3;p=zfs-ubuntu%2F.git Fixed bug when parsing filesystems that have no data on a given date. --- diff --git a/zfs-log-parser b/zfs-log-parser index dbb3c15..f3619db 100755 --- 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+)\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; - 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; } @@ -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}); + if($date_data eq "") { $date_data = "0"; } $data .= sprintf("%10s",$date_data). " "; $date_totals{$date}{data} += $totals{$filesystem}{$date}{data}; }