net collector

April 5, 2025 ยท View on GitHub

The net collector exposes metrics about network interfaces

Metric name prefixnet
Data sourcePerflib
ClassesWin32_PerfRawData_Tcpip_NetworkInterface
Enabled by default?Yes

Flags

--collector.net.nic-include

If given, an interface name needs to match the include regexp in order for the corresponding metrics to be reported

--collector.net.nic-exclude

If given, an interface name needs to not match the exclude regexp in order for the corresponding metrics to be reported

--collector.net.enabled

Comma-separated list of collectors to use. Defaults to all, if not specified. Supported values are: metrics, nic_addresses.

Metrics

NameDescriptionTypeLabels
windows_net_bytes_received_totalTotal bytes received by interfacecounternic
windows_net_bytes_sent_totalTotal bytes transmitted by interfacecounternic
windows_net_bytes_totalTotal bytes received and transmitted by interfacecounternic
windows_net_output_queue_length_packetsLength of the output packet queue (in packets). If this is longer than 2, delays occur.gaugenic
windows_net_packets_outbound_discarded_totalTotal outbound packets that were chosen to be discarded even though no errors had been detected to prevent transmissioncounternic
windows_net_packets_outbound_errors_totalTotal packets that could not be transmitted due to errorscounternic
windows_net_packets_received_discarded_totalTotal inbound packets that were chosen to be discarded even though no errors had been detected to prevent deliverycounternic
windows_net_packets_received_errors_totalTotal packets that could not be received due to errorscounternic
windows_net_packets_received_totalTotal packets received by interfacecounternic
windows_net_packets_received_unknown_totalTotal packets received by interface that were discarded because of an unknown or unsupported protocolcounternic
windows_net_packets_totalTotal packets received and transmitted by interfacecounternic
windows_net_packets_sent_totalTotal packets transmitted by interfacecounternic
windows_net_current_bandwidth_bytesEstimate of the interface's current bandwidth in bytes per secondgaugenic
windows_net_nic_address_infoA metric with a constant '1' value labeled with the network interface's address information.gaugenic, address, family
windows_net_nic_infoA metric with a constant '1' value labeled with the network interface's general information.gaugenic, friendly_name, mac
windows_net_nic_operation_statusThe operational status for the interface as defined in RFC 2863 as IfOperStatus.gaugenic, status
windows_net_route_infoA metric with a constant '1' value labeled with the network interface's route information.gaugenic, src, dest, metric

Example metric

Query the rate of transmitted network traffic

rate(windows_net_bytes_sent_total{instance="localhost"}[2m])

Useful queries

Get total utilisation of network interface as a percentage

rate(windows_net_bytes_total{instance="localhost", nic="Microsoft_Hyper_V_Network_Adapter__1"}[2m]) / windows_net_current_bandwidth_bytes{instance="localhost", nic="Microsoft_Hyper_V_Network_Adapter__1"} * 100

Alerting examples

prometheus.rules

- alert: NetInterfaceUsage
  expr: rate(windows_net_bytes_total[2m]) / windows_net_current_bandwidth_bytes * 100 > 95
  for: 10m
  labels:
    severity: high
  annotations:
    summary: "Network Interface Usage (instance {{ $labels.instance }})"
    description: "Network traffic usage is greater than 95% for interface {{ $labels.nic }}\n  VALUE = {{ $value }}\n  LABELS: {{ $labels }}"