summaryrefslogtreecommitdiffstats
path: root/src/go/collectors/go.d.plugin/modules/windows/collect_tcp.go
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-05 11:19:16 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-07-24 09:53:24 +0000
commitb5f8ee61a7f7e9bd291dd26b0585d03eb686c941 (patch)
treed4d31289c39fc00da064a825df13a0b98ce95b10 /src/go/collectors/go.d.plugin/modules/windows/collect_tcp.go
parentAdding upstream version 1.44.3. (diff)
downloadnetdata-b5f8ee61a7f7e9bd291dd26b0585d03eb686c941.tar.xz
netdata-b5f8ee61a7f7e9bd291dd26b0585d03eb686c941.zip
Adding upstream version 1.46.3.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
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)
+ }
+ }
+}