github.com/netdata/go.d.plugin@v0.58.1/modules/windows/collect_tcp.go (about) 1 // SPDX-License-Identifier: GPL-3.0-or-later 2 3 package windows 4 5 import "github.com/netdata/go.d.plugin/pkg/prometheus" 6 7 const ( 8 metricTCPConnectionFailure = "windows_tcp_connection_failures_total" 9 metricTCPConnectionActive = "windows_tcp_connections_active_total" 10 metricTCPConnectionEstablished = "windows_tcp_connections_established" 11 metricTCPConnectionPassive = "windows_tcp_connections_passive_total" 12 metricTCPConnectionReset = "windows_tcp_connections_reset_total" 13 metricTCPConnectionSegmentsReceived = "windows_tcp_segments_received_total" 14 metricTCPConnectionSegmentsRetransmitted = "windows_tcp_segments_retransmitted_total" 15 metricTCPConnectionSegmentsSent = "windows_tcp_segments_sent_total" 16 ) 17 18 func (w *Windows) collectTCP(mx map[string]int64, pms prometheus.Series) { 19 if !w.cache.collection[collectorTCP] { 20 w.cache.collection[collectorTCP] = true 21 w.addTCPCharts() 22 } 23 24 px := "tcp_" 25 for _, pm := range pms.FindByName(metricTCPConnectionFailure) { 26 if af := pm.Labels.Get("af"); af != "" { 27 mx[px+af+"_conns_failures"] = int64(pm.Value) 28 } 29 } 30 for _, pm := range pms.FindByName(metricTCPConnectionActive) { 31 if af := pm.Labels.Get("af"); af != "" { 32 mx[px+af+"_conns_active"] = int64(pm.Value) 33 } 34 } 35 for _, pm := range pms.FindByName(metricTCPConnectionEstablished) { 36 if af := pm.Labels.Get("af"); af != "" { 37 mx[px+af+"_conns_established"] = int64(pm.Value) 38 } 39 } 40 for _, pm := range pms.FindByName(metricTCPConnectionPassive) { 41 if af := pm.Labels.Get("af"); af != "" { 42 mx[px+af+"_conns_passive"] = int64(pm.Value) 43 } 44 } 45 for _, pm := range pms.FindByName(metricTCPConnectionReset) { 46 if af := pm.Labels.Get("af"); af != "" { 47 mx[px+af+"_conns_resets"] = int64(pm.Value) 48 } 49 } 50 for _, pm := range pms.FindByName(metricTCPConnectionSegmentsReceived) { 51 if af := pm.Labels.Get("af"); af != "" { 52 mx[px+af+"_segments_received"] = int64(pm.Value) 53 } 54 } 55 for _, pm := range pms.FindByName(metricTCPConnectionSegmentsRetransmitted) { 56 if af := pm.Labels.Get("af"); af != "" { 57 mx[px+af+"_segments_retransmitted"] = int64(pm.Value) 58 } 59 } 60 for _, pm := range pms.FindByName(metricTCPConnectionSegmentsSent) { 61 if af := pm.Labels.Get("af"); af != "" { 62 mx[px+af+"_segments_sent"] = int64(pm.Value) 63 } 64 } 65 }