From 1a79ba80ae245dee132d6813e719ac6bbf1e4e7d Mon Sep 17 00:00:00 2001 From: garnier-quentin Date: Fri, 28 Jun 2019 16:04:13 +0200 Subject: [PATCH] enhance docker container --- cloud/docker/restapi/mode/containerusage.pm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cloud/docker/restapi/mode/containerusage.pm b/cloud/docker/restapi/mode/containerusage.pm index d3e931050..fc1769918 100644 --- a/cloud/docker/restapi/mode/containerusage.pm +++ b/cloud/docker/restapi/mode/containerusage.pm @@ -250,7 +250,8 @@ sub manage_selection { write_io => $write_io, cpu_total_usage => $result->{$container_id}->{Stats}->{cpu_stats}->{cpu_usage}->{total_usage}, cpu_system_usage => $result->{$container_id}->{Stats}->{cpu_stats}->{system_cpu_usage}, - cpu_number => scalar(@{$result->{$container_id}->{Stats}->{cpu_stats}->{cpu_usage}->{percpu_usage}}), + cpu_number => defined($result->{$container_id}->{Stats}->{cpu_stats}->{cpu_usage}->{percpu_usage}) ? + scalar(@{$result->{$container_id}->{Stats}->{cpu_stats}->{cpu_usage}->{percpu_usage}}) : 1, memory_usage => $result->{$container_id}->{Stats}->{memory_stats}->{usage}, memory_total => $result->{$container_id}->{Stats}->{memory_stats}->{limit}, };