mirror of
https://github.com/munin-monitoring/contrib.git
synced 2018-11-08 00:59:34 +01:00
Merge pull request #672 from drzraf/memory_by_process_labels
memory_by_process: try to be smarted about labels and cleanup field names more deeply
This commit is contained in:
commit
9e6c5f9ebf
1 changed files with 6 additions and 3 deletions
|
@ -30,18 +30,21 @@ if [ "$1" = "config" ]; then
|
||||||
{
|
{
|
||||||
@a = split;
|
@a = split;
|
||||||
$proc = $a[10];
|
$proc = $a[10];
|
||||||
$proc =~ s|.*/||;
|
$label = $proc;
|
||||||
|
$proc =~ s/ .*//;
|
||||||
|
if($proc =~ /^\[/) { $proc =~ s|/.*||; } else { $proc =~ s|.*/||; }
|
||||||
$proc =~ s/:.*//;
|
$proc =~ s/:.*//;
|
||||||
$proc =~ tr/[]//d;
|
$proc =~ tr/[]//d;
|
||||||
$proc =~ tr/A-Za-z0-9/_/c;
|
$proc =~ tr/A-Za-z0-9/_/c;
|
||||||
$vsz = $a[4];
|
$vsz = $a[4];
|
||||||
$total{$proc} += $vsz;
|
$total{$proc} += $vsz;
|
||||||
|
$labels{$proc} = $label;
|
||||||
}
|
}
|
||||||
my $stack = 0;
|
my $stack = 0;
|
||||||
sub draw() { return $stack++ ? "STACK" : "AREA" }
|
sub draw() { return $stack++ ? "STACK" : "AREA" }
|
||||||
print map
|
print map
|
||||||
{
|
{
|
||||||
"$_.label $_\n" .
|
"$_.label " . $labels{$_} . "\n" .
|
||||||
"$_.min 0\n" .
|
"$_.min 0\n" .
|
||||||
"$_.draw " . draw() . "\n" .
|
"$_.draw " . draw() . "\n" .
|
||||||
"$_.cdef $_,1024,*\n"
|
"$_.cdef $_,1024,*\n"
|
||||||
|
@ -56,7 +59,7 @@ else
|
||||||
{
|
{
|
||||||
@a = split;
|
@a = split;
|
||||||
$proc = $a[10];
|
$proc = $a[10];
|
||||||
$proc =~ s|.*/||;
|
if($proc =~ /^\[/) { $proc =~ s|/.*||; } else { $proc =~ s|.*/||; }
|
||||||
$proc =~ s/:.*//;
|
$proc =~ s/:.*//;
|
||||||
$proc =~ tr/[]//d;
|
$proc =~ tr/[]//d;
|
||||||
$proc =~ tr/A-Za-z0-9/_/c;
|
$proc =~ tr/A-Za-z0-9/_/c;
|
||||||
|
|
Loading…
Reference in a new issue