git-svn-id: http://svn.merethis.net/centreon-esxd/trunk@89 a5eaa968-4c79-4d68-970d-af6011b5b055
This commit is contained in:
Quentin Garnier 2013-11-28 09:58:41 +00:00
parent 933c8d5429
commit 1f3a3465aa
3 changed files with 35 additions and 11 deletions

View File

@ -19,7 +19,7 @@ timeout=60
pidfile=/var/run/centreon_esxd.pid
[ -e /etc/sysconfig/$servicename ] && . /etc/sysconfig/$servicename
[ -e /etc/sysconfig/centreon_esxd ] && . /etc/sysconfig/centreon_esxd
# Check if we can find the binary.
if [ ! -x $binary ]; then

View File

@ -49,23 +49,35 @@ sub run {
}
my %filters = ('name' => $self->{lhost});
my @properties = ('config.network.pnic', 'config.network.vswitch');
my @properties = ('config.network.pnic', 'config.network.vswitch', 'config.network.proxySwitch');
my $result = centreon::esxd::common::get_entities_host($self->{obj_esxd}, 'HostSystem', \%filters, \@properties);
if (!defined($result)) {
return ;
}
# Get Name from vswitch
foreach (@{$$result[0]->{'config.network.vswitch'}}) {
foreach my $keynic (@{$_->pnic}) {
$nic_in_vswitch{$keynic} = 1;
if (defined($$result[0]->{'config.network.vswitch'})) {
foreach (@{$$result[0]->{'config.network.vswitch'}}) {
next if (!defined($_->{pnic}));
foreach my $keynic (@{$_->{pnic}}) {
$nic_in_vswitch{$keynic} = 1;
}
}
}
# Get Name from proxySwitch
if (defined($$result[0]->{'config.network.proxySwitch'})) {
foreach (@{$$result[0]->{'config.network.proxySwitch'}}) {
next if (!defined($_->{pnic}));
foreach my $keynic (@{$_->{pnic}}) {
$nic_in_vswitch{$keynic} = 1;
}
}
}
my $status = 0; # OK
my $output_up = 'Nic Up List: ';
my $output_down = 'Nic Down List: ';
my $output_down_no_vswitch = 'Nic Down List (not in vswitch): ';
my $output_down_no_vswitch = 'Nic Down List (not in vswitch, dvswitch): ';
my $output_up_append = "";
my $output_down_append = "";
my $output_down_no_vswitch_append = "";

View File

@ -68,7 +68,7 @@ sub run {
}
my %filters = ('name' => $self->{lhost});
my @properties = ('config.network.pnic', 'runtime.connectionState', 'config.network.vswitch');
my @properties = ('config.network.pnic', 'runtime.connectionState', 'config.network.vswitch', 'config.network.proxySwitch');
my $result = centreon::esxd::common::get_entities_host($self->{obj_esxd}, 'HostSystem', \%filters, \@properties);
if (!defined($result)) {
return ;
@ -84,9 +84,21 @@ sub run {
my $filter_ok = 0;
# Get Name from vswitch
foreach (@{$$result[0]->{'config.network.vswitch'}}) {
foreach my $keynic (@{$_->pnic}) {
$nic_in_vswitch{$keynic} = 1;
if (defined($$result[0]->{'config.network.vswitch'})) {
foreach (@{$$result[0]->{'config.network.vswitch'}}) {
next if (!defined($_->{pnic}));
foreach my $keynic (@{$_->{pnic}}) {
$nic_in_vswitch{$keynic} = 1;
}
}
}
# Get Name from proxySwitch
if (defined($$result[0]->{'config.network.proxySwitch'})) {
foreach (@{$$result[0]->{'config.network.proxySwitch'}}) {
next if (!defined($_->{pnic}));
foreach my $keynic (@{$_->{pnic}}) {
$nic_in_vswitch{$keynic} = 1;
}
}
}
@ -111,7 +123,7 @@ sub run {
if ($filter_ok == 0) {
my $status = centreon::esxd::common::errors_mask(0, 'UNKNOWN');
$self->{obj_esxd}->print_response(centreon::esxd::common::get_status($status) . "|Can't get physical nic with filter '$self->{pnic}'. (or physical nic not in a vswitch)\n");
$self->{obj_esxd}->print_response(centreon::esxd::common::get_status($status) . "|Can't get physical nic with filter '$self->{pnic}'. (or physical nic not in a 'vswitch' or 'dvswitch')\n");
return ;
}
if ($#${instances} == -1) {