From c5ae8655e695b49a27af181bb9b45d0dd82b9621 Mon Sep 17 00:00:00 2001 From: Ilia Ross Date: Tue, 12 Nov 2024 01:44:20 +0200 Subject: [PATCH] Fix to access from the back as some `netstat` don't have `Idrop` column 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 --- stats-lib-funcs.pl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stats-lib-funcs.pl b/stats-lib-funcs.pl index 232a00c13..94e2619a2 100644 --- a/stats-lib-funcs.pl +++ b/stats-lib-funcs.pl @@ -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);