mirror of
				https://github.com/ClusterCockpit/cc-metric-collector.git
				synced 2025-11-04 10:45:06 +01:00 
			
		
		
		
	Add network device to metric names to NetstatCollector
This commit is contained in:
		@@ -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
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user