From c57e866f9104322490c4393895f5232ef8e96a37 Mon Sep 17 00:00:00 2001 From: Cameron Sparr Date: Thu, 10 Sep 2015 13:53:53 -0600 Subject: [PATCH] Fix net stat reporting for Darwin --- net/net_darwin.go | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/net/net_darwin.go b/net/net_darwin.go index 5dc0c11..7fb2171 100644 --- a/net/net_darwin.go +++ b/net/net_darwin.go @@ -38,11 +38,14 @@ func NetIOCounters(pernic bool) ([]NetIOCountersStat, error) { base = 0 } - parsed := make([]uint64, 0, 3) + parsed := make([]uint64, 0, 6) vv := []string{ - values[base+3], // PacketsRecv - values[base+4], // Errin - values[base+5], // Dropin + values[base+3], // Ipkts == PacketsRecv + values[base+4], // Ierrs == Errin + values[base+5], // Ibytes == BytesRecv + values[base+6], // Opkts == PacketsSent + values[base+7], // Oerrs == Errout + values[base+8], // Obytes == BytesSent } for _, target := range vv { if target == "-" { @@ -61,7 +64,10 @@ func NetIOCounters(pernic bool) ([]NetIOCountersStat, error) { Name: values[0], PacketsRecv: parsed[0], Errin: parsed[1], - Dropin: parsed[2], + BytesRecv: parsed[2], + PacketsSent: parsed[3], + Errout: parsed[4], + BytesSent: parsed[5], } ret = append(ret, n) }