From 432bcbd056d000aba2d3158bd6bb880f5b5bf3c4 Mon Sep 17 00:00:00 2001 From: Cameron Sparr Date: Tue, 15 Dec 2015 08:27:12 -0700 Subject: [PATCH] Add -W flag to netstat on BSD systems This prevents netstat from truncating the interface name to 5 characters. See https://github.com/influxdb/telegraf/issues/438 --- net/net_darwin.go | 2 +- net/net_freebsd.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/net/net_darwin.go b/net/net_darwin.go index 7786f7c..547286b 100644 --- a/net/net_darwin.go +++ b/net/net_darwin.go @@ -17,7 +17,7 @@ import ( // lo0 16384 ::1/128 ::1 869107 - 169411755 869107 - 169411755 - - // lo0 16384 127 127.0.0.1 869107 - 169411755 869107 - 169411755 - - func NetIOCounters(pernic bool) ([]NetIOCountersStat, error) { - out, err := exec.Command("/usr/sbin/netstat", "-ibdn").Output() + out, err := exec.Command("/usr/sbin/netstat", "-ibdnW").Output() if err != nil { return nil, err } diff --git a/net/net_freebsd.go b/net/net_freebsd.go index d6882f1..1b0375c 100644 --- a/net/net_freebsd.go +++ b/net/net_freebsd.go @@ -12,7 +12,7 @@ import ( ) func NetIOCounters(pernic bool) ([]NetIOCountersStat, error) { - out, err := exec.Command("/usr/bin/netstat", "-ibdn").Output() + out, err := exec.Command("/usr/bin/netstat", "-ibdnW").Output() if err != nil { return nil, err }