fix nic name filter nethost vmware

This commit is contained in:
garnier-quentin 2019-02-06 16:32:50 +01:00
parent 82c43c4e7a
commit 2775261bf1
1 changed files with 2 additions and 5 deletions

View File

@ -260,7 +260,6 @@ sub new {
"filter" => { name => 'filter' }, "filter" => { name => 'filter' },
"scope-datacenter:s" => { name => 'scope_datacenter' }, "scope-datacenter:s" => { name => 'scope_datacenter' },
"scope-cluster:s" => { name => 'scope_cluster' }, "scope-cluster:s" => { name => 'scope_cluster' },
"filter-nic" => { name => 'filter_nic' },
"no-proxyswitch" => { name => 'no_proxyswitch' }, "no-proxyswitch" => { name => 'no_proxyswitch' },
"unknown-status:s" => { name => 'unknown_status', default => '%{status} !~ /^connected$/i' }, "unknown-status:s" => { name => 'unknown_status', default => '%{status} !~ /^connected$/i' },
"warning-status:s" => { name => 'warning_status', default => '' }, "warning-status:s" => { name => 'warning_status', default => '' },
@ -303,6 +302,8 @@ sub manage_selection {
foreach my $pnic_name (sort keys %{$response->{data}->{$host_id}->{pnic}}) { foreach my $pnic_name (sort keys %{$response->{data}->{$host_id}->{pnic}}) {
$self->{host}->{$host_name}->{pnic} = {} if (!defined($self->{host}->{$host_name}->{pnic})); $self->{host}->{$host_name}->{pnic} = {} if (!defined($self->{host}->{$host_name}->{pnic}));
next if (defined($self->{option_results}->{nic_name}) && $self->{option_results}->{nic_name} ne '' &&
$pnic_name !~ /$self->{option_results}->{nic_name}/);
$self->{host}->{$host_name}->{pnic}->{$pnic_name} = { $self->{host}->{$host_name}->{pnic}->{$pnic_name} = {
display => $pnic_name, display => $pnic_name,
@ -372,10 +373,6 @@ Search in following cluster(s) (can be a regexp).
ESX nic to check. ESX nic to check.
If not set, we check all nics. If not set, we check all nics.
=item B<--filter-nic>
Nic name is a regexp.
=item B<--unknown-status> =item B<--unknown-status>
Set warning threshold for status (Default: '%{status} !~ /^connected$/i'). Set warning threshold for status (Default: '%{status} !~ /^connected$/i').