mirror of
https://github.com/munin-monitoring/contrib.git
synced 2018-11-08 00:59:34 +01:00
commit
65e4a94cea
@ -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")
|
||||
|
@ -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")
|
||||
|
Loading…
Reference in New Issue
Block a user