--- ps2rrd.pl 2009/07/17 18:35:34 14 +++ ps2rrd.pl 2009/07/19 18:47:52 16 @@ -12,14 +12,19 @@ my $zoom = 2; my $only_veid; +my $by_veid; my $too_small = 64; # M my $filter = qr{(apache|mysql|postgres|cgi-bin|SIP)}; +my $use = 'VSZ'; + GetOptions( 'debug!' => \$debug, 'zoom=i' => \$zoom, - 'veid=i' => \$only_veid, + 'only-veid=i' => \$only_veid, + 'by-veid!' => \$by_veid, 'size=i' => \$too_small, + 'use=s' => \$use, ); @@ -63,15 +68,15 @@ next if defined $only_veid && $only_veid != $veid; $veid =~ s/^0$/_hw_0/; - my $s = c('VSZ'); + my $s = c($use); my $cmd = c('COMMAND'); - if ( $cmd =~ $filter ) { + if ( ! $by_veid && $cmd =~ $filter ) { $veid .= '-' . $1; $vsz->{$t}->{$veid} += $s * 1024; print STDERR uc(substr($1,0,1)); - } elsif ( $s < $too_small ) { + } elsif ( $s < $too_small || $by_veid ) { $vsz->{$t}->{$veid}+= $s * 1024; print STDERR "."; @@ -102,7 +107,7 @@ my @veids = sort keys %$veids; warn "# veids = ",dump( @veids ); -my $rrd_file = 'ps.rrd'; +my $rrd_file = $use . '.rrd'; unlink $rrd_file if -e $rrd_file; my @t = sort keys %$vsz; @@ -129,7 +134,7 @@ source_drawtypes => [ map { $_ ? 'STACK' : 'AREA' } 0 .. $#veids ], periods => [ qw/hour 6hour 12hour day week month year 3years/ ], extended_legend => 1, - title => "memory > $too_small K", + title => "$use > $too_small K", width => 500 * $zoom, height => 200 * $zoom, );