--- ps2rrd.pl 2009/07/17 13:25:34 11 +++ ps2rrd.pl 2009/07/17 18:35:34 14 @@ -13,6 +13,7 @@ my $only_veid; my $too_small = 64; # M +my $filter = qr{(apache|mysql|postgres|cgi-bin|SIP)}; GetOptions( 'debug!' => \$debug, @@ -33,7 +34,8 @@ my $t = mktime( 0, $5, $4, $3, $2 - 1, $1 - 1900 ) if $file =~ m{(\d\d\d\d)-(\d\d)-(\d\d)/(\d\d)(\d\d)}; - warn "# $file ", -s $file, " bytes [$t]\n" if $debug; +# warn "# $file ", -s $file, " bytes [$t]\n" if $debug; + print STDERR "\n$file\t"; my $cols = <$fh>; $cols =~ s/^\s+//; @@ -59,14 +61,23 @@ my $veid = c('VEID'); next if defined $only_veid && $only_veid != $veid; - $veid =~ s/^0$/0-hw/; + $veid =~ s/^0$/_hw_0/; my $s = c('VSZ'); - if ( $s < $too_small ) { + my $cmd = c('COMMAND'); + if ( $cmd =~ $filter ) { + + $veid .= '-' . $1; + $vsz->{$t}->{$veid} += $s * 1024; + print STDERR uc(substr($1,0,1)); + + } elsif ( $s < $too_small ) { + $vsz->{$t}->{$veid}+= $s * 1024; print STDERR "."; + } else { - my $cmd = c('COMMAND'); + $cmd =~ s{-.+$}{}; $cmd =~ s{^/\S+/(\w+?)}{$1}; $cmd =~ s{^\w+ /\S+/(\w+?)}{$1}; @@ -99,7 +110,7 @@ print "\ndrawing $#t intervals ", $t[0], " - ", $t[$#t]; my $rrd = RRD::Simple->new( file => $rrd_file ); -$rrd->create( 'hour', map { ( $_ => 'GAUGE' ) } @veids ); +$rrd->create( map { ( $_ => 'GAUGE' ) } @veids ); foreach my $t ( @t ) { print STDERR ".";