MCPcopy Create free account
hub / github.com/prometheus/procfs / parseNetDevSNMP6Stats

Function parseNetDevSNMP6Stats

net_dev_snmp6.go:77–99  ·  view source on GitHub ↗
(r io.Reader)

Source from the content-addressed store, hash-verified

75}
76
77func parseNetDevSNMP6Stats(r io.Reader) (map[string]uint64, error) {
78 m := make(map[string]uint64)
79
80 scanner := bufio.NewScanner(r)
81 for scanner.Scan() {
82 stat := strings.Fields(scanner.Text())
83 if len(stat) < 2 {
84 continue
85 }
86 key, val := stat[0], stat[1]
87
88 // Expect stat name to contain "6" or be "ifIndex"
89 if strings.Contains(key, "6") || key == "ifIndex" {
90 v, err := strconv.ParseUint(val, 10, 64)
91 if err != nil {
92 return m, err
93 }
94
95 m[key] = v
96 }
97 }
98 return m, scanner.Err()
99}

Callers 1

newNetDevSNMP6Function · 0.85

Calls 1

ErrMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…