mirror of
https://github.com/centreon/centreon-plugins.git
synced 2025-07-21 04:34:55 +02:00
fix(discovery): custom attributes retrieved for vcenter only
This commit is contained in:
parent
71b8076125
commit
fffbbfc1b0
@ -78,12 +78,16 @@ sub run {
|
|||||||
my $disco_stats;
|
my $disco_stats;
|
||||||
|
|
||||||
my $customFields = {};
|
my $customFields = {};
|
||||||
|
|
||||||
|
my $api_type = $self->{connector}->{session1}->get_service_content()->about->apiType;
|
||||||
|
if ($api_type eq 'VirtualCenter') {
|
||||||
my $entries = centreon::vmware::common::get_view($self->{connector}, $self->{connector}->{session1}->get_service_content()->customFieldsManager);
|
my $entries = centreon::vmware::common::get_view($self->{connector}, $self->{connector}->{session1}->get_service_content()->customFieldsManager);
|
||||||
if (defined($entries->{field})) {
|
if (defined($entries->{field})) {
|
||||||
foreach (@{$entries->{field}}) {
|
foreach (@{$entries->{field}}) {
|
||||||
$customFields->{ $_->{key} } = $_->{name};
|
$customFields->{ $_->{key} } = $_->{name};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$disco_stats->{start_time} = time();
|
$disco_stats->{start_time} = time();
|
||||||
|
|
||||||
@ -123,9 +127,11 @@ sub run {
|
|||||||
my @properties = (
|
my @properties = (
|
||||||
'name', 'vm', 'config.virtualNicManagerInfo.netConfig', 'config.product.version',
|
'name', 'vm', 'config.virtualNicManagerInfo.netConfig', 'config.product.version',
|
||||||
'config.product.productLineId', 'hardware.systemInfo.vendor', 'hardware.systemInfo.model',
|
'config.product.productLineId', 'hardware.systemInfo.vendor', 'hardware.systemInfo.model',
|
||||||
'hardware.systemInfo.uuid', 'runtime.powerState', 'runtime.inMaintenanceMode', 'runtime.connectionState',
|
'hardware.systemInfo.uuid', 'runtime.powerState', 'runtime.inMaintenanceMode', 'runtime.connectionState'
|
||||||
'summary.customValue'
|
|
||||||
);
|
);
|
||||||
|
if ($api_type eq 'VirtualCenter') {
|
||||||
|
push @properties, 'summary.customValue';
|
||||||
|
}
|
||||||
|
|
||||||
my $esxs = centreon::vmware::common::get_views($self->{connector}, \@{$cluster->host}, \@properties);
|
my $esxs = centreon::vmware::common::get_views($self->{connector}, \@{$cluster->host}, \@properties);
|
||||||
next if (!defined($esxs));
|
next if (!defined($esxs));
|
||||||
@ -163,9 +169,11 @@ sub run {
|
|||||||
|
|
||||||
@properties = (
|
@properties = (
|
||||||
'parent', 'config.name', 'config.annotation', 'config.template', 'config.uuid', 'config.version',
|
'parent', 'config.name', 'config.annotation', 'config.template', 'config.uuid', 'config.version',
|
||||||
'config.guestId', 'guest.guestState', 'guest.hostName', 'guest.ipAddress', 'runtime.powerState',
|
'config.guestId', 'guest.guestState', 'guest.hostName', 'guest.ipAddress', 'runtime.powerState'
|
||||||
'summary.customValue'
|
|
||||||
);
|
);
|
||||||
|
if ($api_type eq 'VirtualCenter') {
|
||||||
|
push @properties, 'summary.customValue';
|
||||||
|
}
|
||||||
|
|
||||||
my $vms = centreon::vmware::common::get_views($self->{connector}, \@{$esx->vm}, \@properties);
|
my $vms = centreon::vmware::common::get_views($self->{connector}, \@{$esx->vm}, \@properties);
|
||||||
next if (!defined($vms));
|
next if (!defined($vms));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user