my( $line, $rawfs, $used, $pct, $name, %namemap, $target );
- &main::save_data('>', "$RRDDIR/$host/.rrd-disk", "");
+ &main::save_data('>', "$RRDDIR/$host/.rrd-disk", $message);
foreach $line ( split(/\n/,$message) ) {
- if ( $line =~ m!^(\S+)\s.*\s(\d+)\s+\d+\s+(\d+)%\s+[^/]*(/.*)$! ) {
+ chomp($line);
+ $goodline = 0;
+ if ( $line =~ m!^(\S+)\s+\S*\s+(\d+)\s+\d+\s+(\d+)%\s+[^/]*(/.*)$! ) {
+ # Parsed as coming from a Unix-style system
( $rawfs, $used, $pct, $name ) = ( $1, $2, $3, $4 );
+ $goodline = 1;
+ }
+ if ( $line =~ m!^Drive: (.):\\, Size: (\d+)[^,]*, Free: (\d+)[^,]*, (\d+)% full! ) {
+ # Parsed as coming from an NT-style system
+ ( $rawfs, $used, $pct, $name ) = ( "/$1:", ($2-$3)/1024, $4, "/$1" );
+ $goodline = 1;
+ }
+ if ($goodline == 1) {
foreach my $check (@main::DFIGNORE) { # FS's to skip
next if $rawfs =~ /$check/;
next if $name =~ /$check/;
}
$namemap{$target} = $name;
+ } else {
+ &debug("Couldn't parse line: '$line'",8);
}
-
}
$line = "";