Advertisement
ajcorrea

Ubiquiti EdgeOS show interfaces problem

Feb 29th, 2016
140
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --- /dev/null
  2. +++ /opt/vyatta/share/vyatta-op/templates/show/interfaces/problem/node.def
  3. @@ -0,0 +1,2 @@
  4. +help: Show network interface errors counters
  5. +run: ${vyatta_bindir}/vyatta-show-interfaces.pl --action=show-problem
  6.  
  7. --- /opt/vyatta/bin/vyatta-show-interfaces.pl.ok
  8. +++ /opt/vyatta/bin/vyatta-show-interfaces.pl
  9. @@ -41,6 +41,7 @@
  10.      'show'       => \&run_show_intf,
  11.      'show-brief' => \&run_show_intf_brief,
  12.      'show-count' => \&run_show_counters,
  13. +    'show-problem' => \&run_show_problem,
  14.      'clear'      => \&run_clear_intf,
  15.      'reset'      => \&run_reset_intf,
  16.      );
  17. @@ -330,8 +331,13 @@
  18.  sub run_show_counters {
  19.      my @intfs = @_;
  20.  
  21. -    printf("%-12s %10s %10s     %10s %10s\n",
  22. -          "Interface","Rx Packets","Rx Bytes","Tx Packets","Tx Bytes");
  23. +    printf("%-12s\t%10s\t\t%10s\t\t%10s\t\t%10s\n",
  24. +          "Interface",
  25. +          "Rx Packets",
  26. +          "Rx Bytes",
  27. +          "Tx Packets",
  28. +          "Tx Bytes"
  29. +          );
  30.  
  31.      foreach my $intf (@intfs) {
  32.         my ($state, $link) = get_state_link($intf);
  33. @@ -339,12 +345,39 @@
  34.         my %clear = get_clear_stats($intf);
  35.         my %stats = get_intf_stats($intf);
  36.  
  37. -       printf("%-12s %10s %10s     %10s %10s\n", $intf,
  38. +       printf("%-12s\t%10s\t\t%10s\t\t%10s\t\t%10s\n", $intf,
  39.                get_counter_val($clear{rx_packets}, $stats{rx_packets}),
  40.                get_counter_val($clear{rx_bytes},   $stats{rx_bytes}),
  41.                get_counter_val($clear{tx_packets}, $stats{tx_packets}),
  42.                get_counter_val($clear{tx_bytes},   $stats{tx_bytes})
  43.             );
  44. +    }
  45. +}
  46. +#ajcorrea - 01-03-2016
  47. +sub run_show_problem {
  48. +    my @intfs = @_;
  49. +    printf("%-12s\t%10s\t\t%10s\t\t%10s\t\t%10s\n",
  50. +       "Interface",
  51. +       "Rx Errors",
  52. +       "Rx Dropped",
  53. +       "Tx Errors",
  54. +       "Tx Dropped"
  55. +       );
  56. +
  57. +    foreach my $intf (@intfs) {
  58. +        my ($state, $link) = get_state_link($intf);
  59. +        next if $state ne 'up';
  60. +        my %clear = get_clear_stats($intf);
  61. +        my %stats = get_intf_stats($intf);
  62. +
  63. +        printf("%-12s\t%10s\t\t%10s\t\t%10s\t\t%10s\n", $intf,
  64. +            get_counter_val($clear{rx_errors}, $stats{rx_errors}),
  65. +            get_counter_val($clear{rx_dropped}, $stats{rx_dropped}),
  66. +            get_counter_val($clear{tx_errors}, $stats{tx_errors}),
  67. +            get_counter_val($clear{tx_dropped},   $stats{tx_dropped})
  68. +        );
  69. +
  70. +
  71.      }
  72.  }
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement