From 296b62acb7b59e5dc1fa66f21cb52876d326e2f0 Mon Sep 17 00:00:00 2001 From: Matt Layher Date: Tue, 31 Oct 2017 15:26:32 -0400 Subject: [PATCH] netstat: return nothing when /proc/net/snmp6 not found --- collector/netstat_linux.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/collector/netstat_linux.go b/collector/netstat_linux.go index f16c8cf6..a7e7ac93 100644 --- a/collector/netstat_linux.go +++ b/collector/netstat_linux.go @@ -121,6 +121,12 @@ func parseNetStats(r io.Reader, fileName string) (map[string]map[string]string, func getSNMP6Stats(fileName string) (map[string]map[string]string, error) { file, err := os.Open(fileName) if err != nil { + // On systems with IPv6 disabled, this file won't exist. + // Do nothing. + if os.IsNotExist(err) { + return nil, nil + } + return nil, err } defer file.Close()