enhance dell me4 interfaces

This commit is contained in:
garnier-quentin 2020-05-19 10:54:59 +02:00
parent 23bfc27eeb
commit ffc7ab06c5
2 changed files with 10 additions and 1 deletions

View File

@ -146,6 +146,7 @@ sub new {
bless $self, $class; bless $self, $class;
$options{options}->add_options(arguments => { $options{options}->add_options(arguments => {
'filter-port-name:s' => { name => 'filter_port_name' },
'unknown-port-status:s' => { name => 'unknown_port_status', default => '%{health} =~ /unknown/i' }, 'unknown-port-status:s' => { name => 'unknown_port_status', default => '%{health} =~ /unknown/i' },
'warning-port-status:s' => { name => 'warning_port_status', default => '%{health} =~ /degraded/i' }, 'warning-port-status:s' => { name => 'warning_port_status', default => '%{health} =~ /degraded/i' },
'critical-port-status:s' => { name => 'critical_port_status', default => '%{health} =~ /fault/i' } 'critical-port-status:s' => { name => 'critical_port_status', default => '%{health} =~ /fault/i' }
@ -182,6 +183,10 @@ sub manage_selection {
$self->{ports} = {}; $self->{ports} = {};
foreach my $port (@{$result_ports->{port}}) { foreach my $port (@{$result_ports->{port}}) {
my $port_name = $port->{port}; my $port_name = $port->{port};
next if (defined($self->{option_results}->{filter_port_name}) && $self->{option_results}->{filter_port_name} ne ''
&& $port_name !~ /$self->{option_results}->{filter_port_name}/);
$mapping_ports->{ $port->{'durable-id'} } = $port_name; $mapping_ports->{ $port->{'durable-id'} } = $port_name;
$self->{ports}->{$port_name} = { $self->{ports}->{$port_name} = {
@ -230,6 +235,10 @@ Check interfaces.
=over 8 =over 8
=item B<--filter-port-name>
Filter port name (Can be a regexp).
=item B<--unknown-port-status> =item B<--unknown-port-status>
Set unknown threshold for status (Default: '%{status} =~ /unknown/i'). Set unknown threshold for status (Default: '%{status} =~ /unknown/i').

View File

@ -140,7 +140,7 @@ sub new {
bless $self, $class; bless $self, $class;
$options{options}->add_options(arguments => { $options{options}->add_options(arguments => {
'filter-name:s' => { name => 'filter_name' }, 'filter-name:s' => { name => 'filter_name' }
}); });
return $self; return $self;