Skip to content

Commit

Permalink
Fix to access from the back as some netstat don't have Idrop column
Browse files Browse the repository at this point in the history
macOS for example has:

Name       Mtu   Network       Address    Ipkts Ierrs         Ibytes    Opkts Oerrs     Obytes  Coll

While FreeBSD has:

Name       Mtu   Network       Address    Ipkts Ierrs Idrop Ibytes    Opkts Oerrs     Obytes  Coll
  • Loading branch information
iliajie committed Nov 11, 2024
1 parent 3ad5e1e commit c5ae865
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions stats-lib-funcs.pl
Original file line number Diff line number Diff line change
Expand Up @@ -408,8 +408,8 @@ sub stats_network_netstat
next if $. == 1; # Skip header
my @fields = split;
my $iface = $fields[0];
my $ibytes = $fields[7];
my $obytes = $fields[10];
my $ibytes = $fields[-5];
my $obytes = $fields[-2];
$stats{$iface} = [$ibytes, $obytes];
}
close($netstat);
Expand Down

0 comments on commit c5ae865

Please sign in to comment.