mirror of
https://github.com/centreon/centreon-plugins.git
synced 2025-07-27 15:44:21 +02:00
(plugin) cloud::prometheus::restapi - fix legacy compatibility (#4489)
This commit is contained in:
parent
0b420c90a1
commit
1f09bb4d13
@ -186,16 +186,16 @@ sub manage_selection {
|
||||
push @$instances, { name => $_, value => $result->{metric}->{$_} };
|
||||
}
|
||||
|
||||
my $instance_key = join('_', @$instances);
|
||||
my $instance_key = join('_', map { $_->{value} } @$instances);
|
||||
next if (!defined($instance_key) || $instance_key eq '');
|
||||
|
||||
my $value;
|
||||
$value = $options{custom}->compute(aggregation => $self->{option_results}->{aggregation}, values => $result->{values}) if (defined($result->{values}));
|
||||
$value = $result->{value}->[1] if (defined($result->{value}));
|
||||
$self->{expressions}->{$instance_key} = {
|
||||
instances => $instances,
|
||||
$result->{metric}->{__name__} => $value
|
||||
};
|
||||
if (!defined($self->{expressions}->{$instance_key})) {
|
||||
$self->{expressions}->{$instance_key} = { instances => $instances };
|
||||
}
|
||||
$self->{expressions}->{$instance_key}->{ $result->{metric}->{__name__} } = $value;
|
||||
}
|
||||
|
||||
if (scalar(keys %{$self->{expressions}}) <= 0) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user