2
0
mirror of https://github.com/munin-monitoring/contrib.git synced 2018-11-08 00:59:34 +01:00

Merge pull request #682 from scanterog/master

Docker Plugin: Bugfix.
This commit is contained in:
Stig Sandbeck Mathisen 2016-01-05 09:01:16 +01:00
commit 65e4a94cea
2 changed files with 18 additions and 12 deletions

View File

@ -66,14 +66,18 @@ for my $i (1 .. $#containers)
$name =~ s/[-\+*\/\.]/_/g;
# truncate container name with "," character.
$name =~ s/,.*//g;
open(my $file, '<', "/sys/fs/cgroup/cpuacct/docker/$id/cpuacct.usage") or die "Unable to open file, $!";
my $total_cpu_ns = <$file>;
$total_cpu_ns =~ s/\s+$//;
close $file;
open($file, '<', "/sys/fs/cgroup/cpuacct/docker/$id/cpuacct.usage_percpu") or die "Unable to open file, $!";
my @ncpu = split / /, <$file>;
close $file;
push @result, {'name'=>$name, 'total_cpu_ns'=>$total_cpu_ns, 'ncpu'=>$#ncpu};
if (open(my $file, '<', "/sys/fs/cgroup/cpuacct/docker/$id/cpuacct.usage"))
{
my $total_cpu_ns = <$file>;
$total_cpu_ns =~ s/\s+$//;
close $file;
if (open($file, '<', "/sys/fs/cgroup/cpuacct/docker/$id/cpuacct.usage_percpu"))
{
my @ncpu = split / /, <$file>;
close $file;
push @result, {'name'=>$name, 'total_cpu_ns'=>$total_cpu_ns, 'ncpu'=>$#ncpu};
}
}
}
if (defined $ARGV[0] and $ARGV[0] eq "config")

View File

@ -66,10 +66,12 @@ for my $i (1 .. $#containers)
$name =~ s/[-\+*\/\.]/_/g;
# truncate container name with "," character.
$name =~ s/,.*//g;
open(my $file, '<', "/sys/fs/cgroup/memory/docker/$id/memory.usage_in_bytes") or die "Unable to open file, $!";
my $memory_bytes = <$file>;
$memory_bytes =~ s/\s+$//;
push @result, {'name'=>$name, 'memory_bytes'=>$memory_bytes};
if (open(my $file, '<', "/sys/fs/cgroup/memory/docker/$id/memory.usage_in_bytes"))
{
my $memory_bytes = <$file>;
$memory_bytes =~ s/\s+$//;
push @result, {'name'=>$name, 'memory_bytes'=>$memory_bytes};
}
}
if (defined $ARGV[0] and $ARGV[0] eq "config")