feat: Add output_queue_length metric to net collector

Signed-off-by: Ben Reedy <breed808@breed808.com>
This commit is contained in:
Ben Reedy 2023-03-26 06:27:07 +10:00
parent e21407c112
commit 7e293a4230
No known key found for this signature in database
GPG Key ID: 235C15B6086C9D7E
3 changed files with 17 additions and 0 deletions

View File

@ -33,6 +33,7 @@ type NetworkCollector struct {
BytesReceivedTotal *prometheus.Desc
BytesSentTotal *prometheus.Desc
BytesTotal *prometheus.Desc
OutputQueueLength *prometheus.Desc
PacketsOutboundDiscarded *prometheus.Desc
PacketsOutboundErrors *prometheus.Desc
PacketsTotal *prometheus.Desc
@ -70,6 +71,12 @@ func NewNetworkCollector() (Collector, error) {
[]string{"nic"},
nil,
),
OutputQueueLength: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "output_queue_length_packets"),
"(Network.OutputQueueLength)",
[]string{"nic"},
nil,
),
PacketsOutboundDiscarded: prometheus.NewDesc(
prometheus.BuildFQName(Namespace, subsystem, "packets_outbound_discarded_total"),
"(Network.PacketsOutboundDiscarded)",
@ -153,6 +160,7 @@ type networkInterface struct {
BytesSentPerSec float64 `perflib:"Bytes Sent/sec"`
BytesTotalPerSec float64 `perflib:"Bytes Total/sec"`
Name string
OutputQueueLength float64 `perflib:"Output Queue Length"`
PacketsOutboundDiscarded float64 `perflib:"Packets Outbound Discarded"`
PacketsOutboundErrors float64 `perflib:"Packets Outbound Errors"`
PacketsPerSec float64 `perflib:"Packets/sec"`
@ -201,6 +209,12 @@ func (c *NetworkCollector) collect(ctx *ScrapeContext, ch chan<- prometheus.Metr
nic.BytesTotalPerSec,
name,
)
ch <- prometheus.MustNewConstMetric(
c.OutputQueueLength,
prometheus.GaugeValue,
nic.OutputQueueLength,
name,
)
ch <- prometheus.MustNewConstMetric(
c.PacketsOutboundDiscarded,
prometheus.CounterValue,

View File

@ -26,6 +26,7 @@ Name | Description | Type | Labels
`windows_net_bytes_received_total` | Total bytes received by interface | counter | `nic`
`windows_net_bytes_sent_total` | Total bytes transmitted by interface | counter | `nic`
`windows_net_bytes_total` | Total bytes received and transmitted by interface | counter | `nic`
`windows_net_output_queue_length_packets` | Length of the output packet queue (in packets). If this is longer than 2, delays occur. | gauge | `nic`
`windows_net_packets_outbound_discarded_total` | Total outbound packets that were chosen to be discarded even though no errors had been detected to prevent transmission | counter | `nic`
`windows_net_packets_outbound_errors_total` | Total packets that could not be transmitted due to errors | counter | `nic`
`windows_net_packets_received_discarded_total` | Total inbound packets that were chosen to be discarded even though no errors had been detected to prevent delivery | counter | `nic`

View File

@ -95,6 +95,8 @@ windows_exporter_collector_timeout{collector="textfile"} 0
# TYPE windows_net_bytes_sent_total counter
# HELP windows_net_bytes_total (Network.BytesTotalPerSec)
# TYPE windows_net_bytes_total counter
# HELP windows_net_output_queue_length_packets (Network.OutputQueueLength)
# TYPE windows_net_output_queue_length_packets gauge
# HELP windows_net_current_bandwidth_bytes (Network.CurrentBandwidth)
# TYPE windows_net_current_bandwidth_bytes gauge
# HELP windows_net_packets_outbound_discarded_total (Network.PacketsOutboundDiscarded)