(plugin) cloud::prometheus::plugin - adding discovery mode (#3800)
* adding prom discovery mode for targets * adding details to help in disco mode * indent * remove extra blank line * modif regex for ip addr + apply suggestion * adding labels attributes for targets discovery Co-authored-by: Simon Bomm <sbomm@centreon.com>
This commit is contained in:
parent
6fb46214cf
commit
c9afe47aa9
|
@ -56,10 +56,18 @@ sub manage_selection {
|
|||
my %target;
|
||||
$target{instance} = $target_information->{labels}->{instance};
|
||||
$target{filter_instance} = "instance," . $target_information->{labels}->{instance};
|
||||
|
||||
foreach my $entry (keys %{$target_information}) {
|
||||
next if (ref($target_information->{$entry}) ne "HASH" || $entry ne "labels");
|
||||
my @array;
|
||||
foreach my $key (keys %{$target_information->{$entry}}) {
|
||||
push @array, { key => $key, value => $target_information->{$entry}->{$key} };
|
||||
}
|
||||
$target{$entry} = \@array;
|
||||
}
|
||||
$target_information->{labels}->{instance} =~ s/(.*):\d+$//;
|
||||
$target{instance_address} = $1;
|
||||
$target{job} = $target_information->{labels}->{job};
|
||||
$target{group} = $target_information->{labels}->{group};
|
||||
|
||||
push @disco_data, \%target;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue