Ref #5494
git-svn-id: http://svn.merethis.net/centreon-esxd/trunk@60 a5eaa968-4c79-4d68-970d-af6011b5b055
This commit is contained in:
parent
87006e17ea
commit
66b27cab26
|
@ -69,6 +69,7 @@ sub new {
|
|||
port => 5700,
|
||||
datastore_state_error => 'UNKNOWN',
|
||||
vm_state_error => 'UNKNOWN',
|
||||
host_state_error => 'UNKNOWN',
|
||||
vsphere_server => {
|
||||
#'default' => {'url' => 'https://XXXXXX/sdk',
|
||||
# 'username' => 'XXXXX',
|
||||
|
|
|
@ -55,11 +55,14 @@ sub run {
|
|||
my $self = shift;
|
||||
|
||||
my %filters = ('name' => $self->{lhost});
|
||||
my @properties = ('vm');
|
||||
my @properties = ('vm', 'runtime.connectionState');
|
||||
my $result = centreon::esxd::common::get_entities_host($self->{obj_esxd}, 'HostSystem', \%filters, \@properties);
|
||||
if (!defined($result)) {
|
||||
return ;
|
||||
}
|
||||
|
||||
return if (centreon::esxd::common::host_state($self->{obj_esxd}, $self->{lhost},
|
||||
$$result[0]->{'runtime.connectionState'}->val) == 0);
|
||||
|
||||
my @vm_array = ();
|
||||
foreach my $entity_view (@$result) {
|
||||
|
|
|
@ -62,12 +62,15 @@ sub run {
|
|||
}
|
||||
|
||||
my %filters = ('name' => $self->{lhost});
|
||||
my @properties = ('name');
|
||||
my @properties = ('name', 'runtime.connectionState');
|
||||
my $result = centreon::esxd::common::get_entities_host($self->{obj_esxd}, 'HostSystem', \%filters, \@properties);
|
||||
if (!defined($result)) {
|
||||
return ;
|
||||
}
|
||||
|
||||
return if (centreon::esxd::common::host_state($self->{obj_esxd}, $self->{lhost},
|
||||
$$result[0]->{'runtime.connectionState'}->val) == 0);
|
||||
|
||||
my @instances = ('*');
|
||||
|
||||
my $values = centreon::esxd::common::generic_performance_values_historic($self->{obj_esxd},
|
||||
|
|
|
@ -70,11 +70,14 @@ sub run {
|
|||
}
|
||||
|
||||
my %filters = ('name' => $self->{lhost});
|
||||
my @properties = ('config.fileSystemVolume.mountInfo');
|
||||
my @properties = ('config.fileSystemVolume.mountInfo', 'runtime.connectionState');
|
||||
my $result = centreon::esxd::common::get_entities_host($self->{obj_esxd}, 'HostSystem', \%filters, \@properties);
|
||||
if (!defined($result)) {
|
||||
return ;
|
||||
}
|
||||
|
||||
return if (centreon::esxd::common::host_state($self->{obj_esxd}, $self->{lhost},
|
||||
$$result[0]->{'runtime.connectionState'}->val) == 0);
|
||||
|
||||
my %uuid_list = ();
|
||||
my %disk_name = ();
|
||||
|
|
|
@ -41,12 +41,16 @@ sub run {
|
|||
my $self = shift;
|
||||
|
||||
my %filters = ('name' => $self->{lhost});
|
||||
my @properties = ('runtime.healthSystemRuntime.hardwareStatusInfo.cpuStatusInfo', 'runtime.healthSystemRuntime.systemHealthInfo.numericSensorInfo');
|
||||
my @properties = ('runtime.healthSystemRuntime.hardwareStatusInfo.cpuStatusInfo', 'runtime.healthSystemRuntime.systemHealthInfo.numericSensorInfo',
|
||||
'runtime.connectionState');
|
||||
my $result = centreon::esxd::common::get_entities_host($self->{obj_esxd}, 'HostSystem', \%filters, \@properties);
|
||||
if (!defined($result)) {
|
||||
return ;
|
||||
}
|
||||
|
||||
return if (centreon::esxd::common::host_state($self->{obj_esxd}, $self->{lhost},
|
||||
$$result[0]->{'runtime.connectionState'}->val) == 0);
|
||||
|
||||
my $status = 0; # OK
|
||||
my $output_critical = '';
|
||||
my $output_critical_append = '';
|
||||
|
|
|
@ -61,11 +61,14 @@ sub run {
|
|||
}
|
||||
|
||||
my %filters = ('name' => $self->{lhost});
|
||||
my @properties = ('summary.hardware.memorySize');
|
||||
my @properties = ('summary.hardware.memorySize', 'runtime.connectionState');
|
||||
my $result = centreon::esxd::common::get_entities_host($self->{obj_esxd}, 'HostSystem', \%filters, \@properties);
|
||||
if (!defined($result)) {
|
||||
return ;
|
||||
}
|
||||
|
||||
return if (centreon::esxd::common::host_state($self->{obj_esxd}, $self->{lhost},
|
||||
$$result[0]->{'runtime.connectionState'}->val) == 0);
|
||||
|
||||
my $memory_size = $$result[0]->{'summary.hardware.memorySize'};
|
||||
|
||||
|
|
|
@ -66,11 +66,15 @@ sub run {
|
|||
}
|
||||
|
||||
my %filters = ('name' => $self->{lhost});
|
||||
my @properties = ('config.network.pnic');
|
||||
my @properties = ('config.network.pnic', 'runtime.connectionState');
|
||||
my $result = centreon::esxd::common::get_entities_host($self->{obj_esxd}, 'HostSystem', \%filters, \@properties);
|
||||
if (!defined($result)) {
|
||||
return ;
|
||||
}
|
||||
|
||||
return if (centreon::esxd::common::host_state($self->{obj_esxd}, $self->{lhost},
|
||||
$$result[0]->{'runtime.connectionState'}->val) == 0);
|
||||
|
||||
my %pnic_def = ();
|
||||
foreach (@{$$result[0]->{'config.network.pnic'}}) {
|
||||
if (defined($_->linkSpeed)) {
|
||||
|
|
|
@ -41,11 +41,14 @@ sub run {
|
|||
my $self = shift;
|
||||
|
||||
my %filters = ('name' => $self->{lhost});
|
||||
my @properties = ('summary.overallStatus');
|
||||
my @properties = ('summary.overallStatus', 'runtime.connectionState');
|
||||
my $result = centreon::esxd::common::get_entities_host($self->{obj_esxd}, 'HostSystem', \%filters, \@properties);
|
||||
if (!defined($result)) {
|
||||
return ;
|
||||
}
|
||||
|
||||
return if (centreon::esxd::common::host_state($self->{obj_esxd}, $self->{lhost},
|
||||
$$result[0]->{'runtime.connectionState'}->val) == 0);
|
||||
|
||||
my $status = 0; # OK
|
||||
my $output = '';
|
||||
|
|
|
@ -61,11 +61,14 @@ sub run {
|
|||
}
|
||||
|
||||
my %filters = ('name' => $self->{lhost});
|
||||
my @properties = ('name');
|
||||
my @properties = ('name', 'runtime.connectionState');
|
||||
my $result = centreon::esxd::common::get_entities_host($self->{obj_esxd}, 'HostSystem', \%filters, \@properties);
|
||||
if (!defined($result)) {
|
||||
return ;
|
||||
}
|
||||
|
||||
return if (centreon::esxd::common::host_state($self->{obj_esxd}, $self->{lhost},
|
||||
$$result[0]->{'runtime.connectionState'}->val) == 0);
|
||||
|
||||
my $values = centreon::esxd::common::generic_performance_values_historic($self->{obj_esxd},
|
||||
$$result[0],
|
||||
|
|
|
@ -47,15 +47,18 @@ sub run {
|
|||
}
|
||||
|
||||
my %filters = ('name' => $self->{lhost});
|
||||
my @properties = ('runtime.bootTime');
|
||||
my @properties = ('runtime.bootTime', 'runtime.connectionState');
|
||||
my $result = centreon::esxd::common::get_entities_host($self->{obj_esxd}, 'HostSystem', \%filters, \@properties);
|
||||
if (!defined($result)) {
|
||||
return ;
|
||||
}
|
||||
|
||||
return if (centreon::esxd::common::host_state($self->{obj_esxd}, $self->{lhost},
|
||||
$$result[0]->{'runtime.connectionState'}->val) == 0);
|
||||
|
||||
my $create_time = Date::Parse::str2time($$result[0]->{'runtime.bootTime'});
|
||||
if (!defined($create_time)) {
|
||||
$status = centreon::esxd::common::errors_mask(0, 'UNKNOWN');
|
||||
my $status = centreon::esxd::common::errors_mask(0, 'UNKNOWN');
|
||||
$self->{obj_esxd}->print_response(centreon::esxd::common::get_status($status) . "|Can't Parse date '" . $$result[0]->{'runtime.bootTime'} . "'.\n");
|
||||
return ;
|
||||
}
|
||||
|
|
|
@ -264,6 +264,19 @@ sub vm_state {
|
|||
return 1;
|
||||
}
|
||||
|
||||
sub host_state {
|
||||
my ($obj_esxd, $host, $connection_state) = @_;
|
||||
|
||||
if ($connection_state !~ /^connected$/i) {
|
||||
my $output = "Host '" . $host . "' not connected. Current Connection State: '$connection_state'.";
|
||||
my $status = errors_mask(0, $obj_esxd->{centreonesxd_config}->{host_state_error});
|
||||
$obj_esxd->print_response(get_status($status) . "|$output\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
sub stats_info {
|
||||
my ($obj_esxd, $rh, $current_fileno, $args) = @_;
|
||||
my $output;
|
||||
|
|
Loading…
Reference in New Issue