From 56596079931c3de0a8b0ee091e272bea83381cec Mon Sep 17 00:00:00 2001 From: Thomas Roehl Date: Thu, 25 Mar 2021 15:54:17 +0100 Subject: [PATCH] Add network device to metric names to NetstatCollector --- collectors/netstatMetric.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/collectors/netstatMetric.go b/collectors/netstatMetric.go index e25d578..fb9c878 100644 --- a/collectors/netstatMetric.go +++ b/collectors/netstatMetric.go @@ -6,6 +6,7 @@ import ( "strings" "time" "log" + "fmt" ) const NETSTATFILE = `/proc/net/dev` @@ -46,8 +47,7 @@ func (m *NetstatCollector) Read(interval time.Duration){ for i, name := range matches { v, err := strconv.ParseInt(f[i], 10, 0) if err == nil { - - m.node[name] = float64(v) * 1.0e-3 + m.node[fmt.Sprintf("%s_%s", dev, name)] = float64(v) * 1.0e-3 } } }