From: Michael Brown Date: Fri, 29 Jun 2001 14:31:17 +0000 (+0000) Subject: Added support for logging disk sizes of NT machines X-Git-Tag: spong-2_4_6~10 X-Git-Url: http://git.etc.gen.nz/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=671300f60365c67a75838780244f24e8d72578de;p=spong.git Added support for logging disk sizes of NT machines Added a high-level (8) debug message when a line can't be parsed. --- diff --git a/contrib/plugins/spong-server/data_rrd_disk b/contrib/plugins/spong-server/data_rrd_disk index 9bfd3be..eb97f38 100755 --- a/contrib/plugins/spong-server/data_rrd_disk +++ b/contrib/plugins/spong-server/data_rrd_disk @@ -26,12 +26,23 @@ sub data_rrd_disks { 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/; @@ -74,8 +85,9 @@ sub data_rrd_disks { } $namemap{$target} = $name; + } else { + &debug("Couldn't parse line: '$line'",8); } - } $line = "";