Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --- /dev/null
- +++ /opt/vyatta/share/vyatta-op/templates/show/interfaces/problem/node.def
- @@ -0,0 +1,2 @@
- +help: Show network interface errors counters
- +run: ${vyatta_bindir}/vyatta-show-interfaces.pl --action=show-problem
- --- /opt/vyatta/bin/vyatta-show-interfaces.pl.ok
- +++ /opt/vyatta/bin/vyatta-show-interfaces.pl
- @@ -41,6 +41,7 @@
- 'show' => \&run_show_intf,
- 'show-brief' => \&run_show_intf_brief,
- 'show-count' => \&run_show_counters,
- + 'show-problem' => \&run_show_problem,
- 'clear' => \&run_clear_intf,
- 'reset' => \&run_reset_intf,
- );
- @@ -330,8 +331,13 @@
- sub run_show_counters {
- my @intfs = @_;
- - printf("%-12s %10s %10s %10s %10s\n",
- - "Interface","Rx Packets","Rx Bytes","Tx Packets","Tx Bytes");
- + printf("%-12s\t%10s\t\t%10s\t\t%10s\t\t%10s\n",
- + "Interface",
- + "Rx Packets",
- + "Rx Bytes",
- + "Tx Packets",
- + "Tx Bytes"
- + );
- foreach my $intf (@intfs) {
- my ($state, $link) = get_state_link($intf);
- @@ -339,12 +345,39 @@
- my %clear = get_clear_stats($intf);
- my %stats = get_intf_stats($intf);
- - printf("%-12s %10s %10s %10s %10s\n", $intf,
- + printf("%-12s\t%10s\t\t%10s\t\t%10s\t\t%10s\n", $intf,
- get_counter_val($clear{rx_packets}, $stats{rx_packets}),
- get_counter_val($clear{rx_bytes}, $stats{rx_bytes}),
- get_counter_val($clear{tx_packets}, $stats{tx_packets}),
- get_counter_val($clear{tx_bytes}, $stats{tx_bytes})
- );
- + }
- +}
- +#ajcorrea - 01-03-2016
- +sub run_show_problem {
- + my @intfs = @_;
- + printf("%-12s\t%10s\t\t%10s\t\t%10s\t\t%10s\n",
- + "Interface",
- + "Rx Errors",
- + "Rx Dropped",
- + "Tx Errors",
- + "Tx Dropped"
- + );
- +
- + foreach my $intf (@intfs) {
- + my ($state, $link) = get_state_link($intf);
- + next if $state ne 'up';
- + my %clear = get_clear_stats($intf);
- + my %stats = get_intf_stats($intf);
- +
- + printf("%-12s\t%10s\t\t%10s\t\t%10s\t\t%10s\n", $intf,
- + get_counter_val($clear{rx_errors}, $stats{rx_errors}),
- + get_counter_val($clear{rx_dropped}, $stats{rx_dropped}),
- + get_counter_val($clear{tx_errors}, $stats{tx_errors}),
- + get_counter_val($clear{tx_dropped}, $stats{tx_dropped})
- + );
- +
- +
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment