summaryrefslogtreecommitdiffstats
path: root/src/go/collectors/go.d.plugin/modules/windows/collect_tcp.go
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/go/collectors/go.d.plugin/modules/windows/collect_tcp.go65
1 files changed, 65 insertions, 0 deletions
diff --git a/src/go/collectors/go.d.plugin/modules/windows/collect_tcp.go b/src/go/collectors/go.d.plugin/modules/windows/collect_tcp.go
new file mode 100644
index 000000000..20c8f8df7
--- /dev/null
+++ b/src/go/collectors/go.d.plugin/modules/windows/collect_tcp.go
@@ -0,0 +1,65 @@
+// SPDX-License-Identifier: GPL-3.0-or-later
+
+package windows
+
+import "github.com/netdata/netdata/go/go.d.plugin/pkg/prometheus"
+
+const (
+ metricTCPConnectionFailure = "windows_tcp_connection_failures_total"
+ metricTCPConnectionActive = "windows_tcp_connections_active_total"
+ metricTCPConnectionEstablished = "windows_tcp_connections_established"
+ metricTCPConnectionPassive = "windows_tcp_connections_passive_total"
+ metricTCPConnectionReset = "windows_tcp_connections_reset_total"
+ metricTCPConnectionSegmentsReceived = "windows_tcp_segments_received_total"
+ metricTCPConnectionSegmentsRetransmitted = "windows_tcp_segments_retransmitted_total"
+ metricTCPConnectionSegmentsSent = "windows_tcp_segments_sent_total"
+)
+
+func (w *Windows) collectTCP(mx map[string]int64, pms prometheus.Series) {
+ if !w.cache.collection[collectorTCP] {
+ w.cache.collection[collectorTCP] = true
+ w.addTCPCharts()
+ }
+
+ px := "tcp_"
+ for _, pm := range pms.FindByName(metricTCPConnectionFailure) {
+ if af := pm.Labels.Get("af"); af != "" {
+ mx[px+af+"_conns_failures"] = int64(pm.Value)
+ }
+ }
+ for _, pm := range pms.FindByName(metricTCPConnectionActive) {
+ if af := pm.Labels.Get("af"); af != "" {
+ mx[px+af+"_conns_active"] = int64(pm.Value)
+ }
+ }
+ for _, pm := range pms.FindByName(metricTCPConnectionEstablished) {
+ if af := pm.Labels.Get("af"); af != "" {
+ mx[px+af+"_conns_established"] = int64(pm.Value)
+ }
+ }
+ for _, pm := range pms.FindByName(metricTCPConnectionPassive) {
+ if af := pm.Labels.Get("af"); af != "" {
+ mx[px+af+"_conns_passive"] = int64(pm.Value)
+ }
+ }
+ for _, pm := range pms.FindByName(metricTCPConnectionReset) {
+ if af := pm.Labels.Get("af"); af != "" {
+ mx[px+af+"_conns_resets"] = int64(pm.Value)
+ }
+ }
+ for _, pm := range pms.FindByName(metricTCPConnectionSegmentsReceived) {
+ if af := pm.Labels.Get("af"); af != "" {
+ mx[px+af+"_segments_received"] = int64(pm.Value)
+ }
+ }
+ for _, pm := range pms.FindByName(metricTCPConnectionSegmentsRetransmitted) {
+ if af := pm.Labels.Get("af"); af != "" {
+ mx[px+af+"_segments_retransmitted"] = int64(pm.Value)
+ }
+ }
+ for _, pm := range pms.FindByName(metricTCPConnectionSegmentsSent) {
+ if af := pm.Labels.Get("af"); af != "" {
+ mx[px+af+"_segments_sent"] = int64(pm.Value)
+ }
+ }
+}