Projet

Général

Profil

Révision 0a5f6adf

ID0a5f6adf2cf5209a9b7a543f39a3ac4125b19945
Parent ae03bc6f
Enfant 65e4a94c

Ajouté par Samuel Cantero il y a presque 10 ans

Docker Plugin

Ignore containers in weird state.

Voir les différences:

plugins/docker/docker_cpu
66 66
   $name =~ s/[-\+*\/\.]/_/g;
67 67
   # truncate container name with "," character.
68 68
   $name =~ s/,.*//g;
69
   open(my $file, '<', "/sys/fs/cgroup/cpuacct/docker/$id/cpuacct.usage") or die "Unable to open file, $!";
70
   my $total_cpu_ns = <$file>;
71
   $total_cpu_ns =~ s/\s+$//;
72
   close $file;
73
   open($file, '<', "/sys/fs/cgroup/cpuacct/docker/$id/cpuacct.usage_percpu") or die "Unable to open file, $!";
74
   my @ncpu = split / /, <$file>;
75
   close $file;
76
   push @result, {'name'=>$name, 'total_cpu_ns'=>$total_cpu_ns, 'ncpu'=>$#ncpu};
69
   if (open(my $file, '<', "/sys/fs/cgroup/cpuacct/docker/$id/cpuacct.usage"))
70
   {
71
      my $total_cpu_ns = <$file>;
72
      $total_cpu_ns =~ s/\s+$//;
73
      close $file;
74
      if (open($file, '<', "/sys/fs/cgroup/cpuacct/docker/$id/cpuacct.usage_percpu"))
75
      {
76
         my @ncpu = split / /, <$file>;
77
         close $file;
78
         push @result, {'name'=>$name, 'total_cpu_ns'=>$total_cpu_ns, 'ncpu'=>$#ncpu};
79
      }
80
   }
77 81
}
78 82
 
79 83
if (defined $ARGV[0] and $ARGV[0] eq "config")

Formats disponibles : Unified diff