Skip to content

Commit

Permalink
netstat: return nothing when /proc/net/snmp6 not found
Browse files Browse the repository at this point in the history
  • Loading branch information
mdlayher authored and SuperQ committed Nov 7, 2017
1 parent 6e2053c commit e583fe6
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions collector/netstat_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit e583fe6

Please sign in to comment.