prometheus/node_exporter · error
could not get network interfaces
Error message
could not get network interfaces: %w
What it means
When --collector.netdev.address-info is enabled, the netdev collector additionally calls Go's net.Interfaces() to enumerate interfaces and their addresses for the node_network_address_info metric. Any failure from that standard-library call is wrapped as 'could not get network interfaces' and aborts the Update.
Solutions
- Verify the environment allows interface enumeration: run `ip addr` or `ifconfig` in the same namespace.
- Disable the flag if address info is not needed: --collector.netdev.address-info=false (run with --collector.netdev.address-info without enabling, per defaults).
- Check seccomp/AppArmor profiles that may block socket(AF_NETLINK) or getifaddrs syscalls.
- Inspect the wrapped inner error for the failing syscall.
- Restart the exporter if the failure appeared only after long uptime (possible fd/resource leak).
Example fix
// before: address-info enabled in restricted container node_exporter --collector.netdev.address-info // after: disable if not required node_exporter --collector.disable-defaults --collector.netdev
Defensive patterns
Strategy: try-catch
Validate before calling
// preflight: interface enumeration must succeed before enabling address-info
if _, err := net.Interfaces(); err != nil {
return fmt.Errorf("environment cannot enumerate interfaces: %w", err)
} Try / catch
err := collector.Update(ch)
if err != nil && strings.Contains(err.Error(), "could not get network interfaces") {
logger.Warn("address-info disabled: interface enumeration failed", "err", err)
return nil
} Prevention
- Enable --collector.netdev.address-info only in environments where getifaddrs works
- Review seccomp/AppArmor profiles for socket restrictions
- Restart exporter if failures appear only after long uptime (fd/memory exhaustion)
- Confirm with `ip addr` that enumeration works in the target namespace
When it happens
Trigger: net.Interfaces() fails during the address-info phase of Update — OS syscall failure enumerating interfaces (e.g. socket creation for getifaddrs blocked, or memory/resource exhaustion).
Common situations: Address-info flag enabled in hardened containers where getifaddrs/netlink enumeration is blocked by seccomp; resource exhaustion in long-running processes (fd/memory); unusual network namespace states.
Related errors
- net.Interfaces() failed
- getifaddrs() failed
- getifaddrs() failed
- failed to initialize ethtool library
- could not get link modes
AI-assisted analysis of prometheus/node_exporter@17ddd77c59 (2026-09-07).
Data as JSON: /api/errors/8de880f84c3c22a0.
Report an issue: GitHub.
Appendix: source
Thrown at collector/netdev_common.go:142
labels := []string{"device"}
labelValues := []string{dev}
if devLabels, exists := netDevLabels[dev]; exists {
for labelName, labelValue := range devLabels {
labels = append(labels, labelName)
labelValues = append(labelValues, labelValue)
}
}
for key, value := range devStats {
desc := c.metricDesc(key, labels)
ch <- prometheus.MustNewConstMetric(desc, prometheus.CounterValue, float64(value), labelValues...)
}
}
if *netdevAddressInfo {
interfaces, err := net.Interfaces()
if err != nil {
return fmt.Errorf("could not get network interfaces: %w", err)
}
desc := prometheus.NewDesc(prometheus.BuildFQName(namespace, "network_address",
"info"), "node network address by device",
[]string{"device", "address", "netmask", "scope"}, nil)
for _, addr := range getAddrsInfo(interfaces, &c.deviceFilter, c.logger) {
ch <- prometheus.MustNewConstMetric(desc, prometheus.GaugeValue, 1,
addr.device, addr.addr, addr.netmask, addr.scope)
}
}
return nil
}
type addrInfo struct {
device string
addr string
scope stringView on GitHub (pinned to 17ddd77c59)