fix(plugin): cadvisor undefined array when no stats available (#2866)
This commit is contained in:
parent
43efe5f014
commit
e82f1d0bde
|
@ -112,7 +112,7 @@ sub manage_selection {
|
||||||
my $read_io = {};
|
my $read_io = {};
|
||||||
my $write_io = {};
|
my $write_io = {};
|
||||||
|
|
||||||
|
if (keys $first_stat->{diskio}) {
|
||||||
$self->{containers}->{$container_id} = {
|
$self->{containers}->{$container_id} = {
|
||||||
node_name => $result->{$container_id}->{NodeName},
|
node_name => $result->{$container_id}->{NodeName},
|
||||||
display => defined($self->{option_results}->{use_name}) ? $name : $container_id,
|
display => defined($self->{option_results}->{use_name}) ? $name : $container_id,
|
||||||
|
@ -141,9 +141,10 @@ sub manage_selection {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (scalar(keys %{$self->{containers}}) <= 0) {
|
if (scalar(keys %{$self->{containers}}) <= 0) {
|
||||||
$self->{output}->add_option_msg(short_msg => "No containers found.");
|
$self->{output}->add_option_msg(short_msg => "No containers found or no data available for diskio metrics.");
|
||||||
$self->{output}->option_exit();
|
$self->{output}->option_exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue