2
0
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:
sumpfralle 2016-10-17 03:24:44 +02:00 committed by GitHub
commit 9e6c5f9ebf

View File

@ -30,18 +30,21 @@ if [ "$1" = "config" ]; then
{
@a = split;
$proc = $a[10];
$proc =~ s|.*/||;
$label = $proc;
$proc =~ s/ .*//;
if($proc =~ /^\[/) { $proc =~ s|/.*||; } else { $proc =~ s|.*/||; }
$proc =~ s/:.*//;
$proc =~ tr/[]//d;
$proc =~ tr/A-Za-z0-9/_/c;
$vsz = $a[4];
$total{$proc} += $vsz;
$labels{$proc} = $label;
}
my $stack = 0;
sub draw() { return $stack++ ? "STACK" : "AREA" }
print map
{
"$_.label $_\n" .
"$_.label " . $labels{$_} . "\n" .
"$_.min 0\n" .
"$_.draw " . draw() . "\n" .
"$_.cdef $_,1024,*\n"
@ -56,7 +59,7 @@ else
{
@a = split;
$proc = $a[10];
$proc =~ s|.*/||;
if($proc =~ /^\[/) { $proc =~ s|/.*||; } else { $proc =~ s|.*/||; }
$proc =~ s/:.*//;
$proc =~ tr/[]//d;
$proc =~ tr/A-Za-z0-9/_/c;