This commit is contained in:
Quentin Garnier 2014-04-09 15:33:46 +02:00
parent 8592dab591
commit 0c8d8a0a76
1 changed files with 8 additions and 0 deletions

View File

@ -64,6 +64,7 @@ sub new {
"interface:s" => { name => 'interface' }, "interface:s" => { name => 'interface' },
"speed:s" => { name => 'speed' }, "speed:s" => { name => 'speed' },
"filter-status:s" => { name => 'filter_status' }, "filter-status:s" => { name => 'filter_status' },
"skip-speed0" => { name => 'skip_speed0' },
"use-adminstatus" => { name => 'use_adminstatus' }, "use-adminstatus" => { name => 'use_adminstatus' },
"regexp" => { name => 'use_regexp' }, "regexp" => { name => 'use_regexp' },
"regexp-isensitive" => { name => 'use_regexpi' }, "regexp-isensitive" => { name => 'use_regexpi' },
@ -111,6 +112,8 @@ sub run {
if (defined($self->{option_results}->{speed}) && $self->{option_results}->{speed} ne '') { if (defined($self->{option_results}->{speed}) && $self->{option_results}->{speed} ne '') {
$interface_speed = $self->{option_results}->{speed}; $interface_speed = $self->{option_results}->{speed};
} }
next if (defined($self->{option_results}->{skip_speed0}) && $interface_speed == 0);
if (defined($self->{option_results}->{filter_status}) && $operstatus[$result->{$oid_operstatus . "." . $_} - 1] !~ /$self->{option_results}->{filter_status}/i) { if (defined($self->{option_results}->{filter_status}) && $operstatus[$result->{$oid_operstatus . "." . $_} - 1] !~ /$self->{option_results}->{filter_status}/i) {
next; next;
} }
@ -236,6 +239,7 @@ sub disco_show {
if (defined($self->{option_results}->{speed}) && $self->{option_results}->{speed} ne '') { if (defined($self->{option_results}->{speed}) && $self->{option_results}->{speed} ne '') {
$interface_speed = $self->{option_results}->{speed}; $interface_speed = $self->{option_results}->{speed};
} }
next if (defined($self->{option_results}->{skip_speed0}) && $interface_speed == 0);
if (defined($self->{option_results}->{filter_status}) && $operstatus[$result->{$oid_operstatus . "." . $_} - 1] !~ /$self->{option_results}->{filter_status}/i) { if (defined($self->{option_results}->{filter_status}) && $operstatus[$result->{$oid_operstatus . "." . $_} - 1] !~ /$self->{option_results}->{filter_status}/i) {
next; next;
} }
@ -278,6 +282,10 @@ Allows to use regexp non case-sensitive (with --regexp).
Set interface speed (in Mb). Set interface speed (in Mb).
=item B<--skip-speed0>
Don't display interface with speed 0.
=item B<--filter-status> =item B<--filter-status>
Display interfaces matching the filter (example: 'up'). Display interfaces matching the filter (example: 'up').