add drs and das config enable 'cluster-status'

This commit is contained in:
garnier-quentin 2020-04-06 13:55:41 +02:00
parent ba6bcf1533
commit 6c75fd1868
4 changed files with 14 additions and 9 deletions

View File

@ -1,3 +1,6 @@
2020-04-06 Quentin Garnier <qgarnier@centreon.com> - 3.1.2
* Enhancement: add drs and das config enable 'cluster-status'
2020-02-20 Quentin Garnier <qgarnier@centreon.com> - 3.1.1
* Fix: discovery folders management
* Fix: no virtual machines running for 'datastore-vm'

View File

@ -54,7 +54,7 @@ BEGIN {
use base qw(centreon::vmware::script);
use vars qw(%centreon_vmware_config);
my $VERSION = '3.1.1';
my $VERSION = '3.1.2';
my %handlers = (TERM => {}, HUP => {}, CHLD => {});
my @load_modules = (

View File

@ -38,7 +38,7 @@ sub checkArgs {
my ($self, %options) = @_;
if (defined($options{arguments}->{cluster_name}) && $options{arguments}->{cluster_name} eq '') {
centreon::vmware::common::set_response(code => 100, short_message => "Argument error: cluster name cannot be null");
centreon::vmware::common::set_response(code => 100, short_message => 'Argument error: cluster name cannot be null');
return 1;
}
@ -50,7 +50,7 @@ sub run {
my $vsan_cluster_health;
my $filters = $self->build_filter(label => 'name', search_option => 'cluster_name', is_regexp => 'filter');
my @properties = ('name', 'summary.overallStatus');
my @properties = ('name', 'summary.overallStatus', 'configuration');
if ($self->is_vsan_enabled()) {
$vsan_cluster_health = centreon::vmware::common::vsan_create_mo_view(
vsan_vim => $self->{connector}->{vsan_vim},
@ -59,15 +59,17 @@ sub run {
);
push @properties, 'configurationEx';
}
my $views = centreon::vmware::common::search_entities(command => $self, view_type => 'ComputeResource', properties => \@properties, filter => $filters);
my $views = centreon::vmware::common::search_entities(command => $self, view_type => 'ClusterComputeResource', properties => \@properties, filter => $filters);
return if (!defined($views));
my $data = {};
foreach my $view (@$views) {
my $entity_value = $view->{mo_ref}->{value};
$data->{$entity_value} = {
name => $view->{name},
overall_status => $view->{'summary.overallStatus'}->val
overall_status => $view->{'summary.overallStatus'}->val,
ha_enabled => (defined($view->{configuration}->{dasConfig}->{enabled}) && $view->{configuration}->{dasConfig}->{enabled} =~ /^1|true/i) ? 'true' : 'false',
drs_enabled => (defined($view->{configuration}->{drsConfig}->{enabled}) && $view->{configuration}->{drsConfig}->{enabled} =~ /^1|true/i) ? 'true' : 'false'
};
if (defined($view->{configurationEx}->{vsanConfigInfo}) && $view->{configurationEx}->{vsanConfigInfo}->enabled == 1) {
@ -75,12 +77,12 @@ sub run {
cluster => $view,
includeObjUuids => 'false',
fetchFromCache => 'false',
fields => ['clusterStatus'],
fields => ['clusterStatus']
);
$data->{$entity_value}->{vsan_cluster_status} = $summary->clusterStatus->status;
}
}
centreon::vmware::common::set_response(data => $data);
}

View File

@ -45,7 +45,7 @@ sub init_response {
my (%options) = @_;
$manager_response->{code} = 0;
$manager_response->{vmware_connector_version} = '3.1.1';
$manager_response->{vmware_connector_version} = '3.1.2';
$manager_response->{short_message} = 'OK';
$manager_response->{extra_message} = '';
$manager_response->{identity} = $options{identity} if (defined($options{identity}));