mirror of
				https://github.com/ClusterCockpit/cc-metric-collector.git
				synced 2025-11-04 02:35:07 +01:00 
			
		
		
		
	This commit is contained in:
		@@ -1,10 +1,3 @@
 | 
			
		||||
// Copyright (C) NHR@FAU, University Erlangen-Nuremberg.
 | 
			
		||||
// All rights reserved. This file is part of cc-lib.
 | 
			
		||||
// Use of this source code is governed by a MIT-style
 | 
			
		||||
// license that can be found in the LICENSE file.
 | 
			
		||||
// additional authors:
 | 
			
		||||
// Holger Obermaier (NHR@KIT)
 | 
			
		||||
 | 
			
		||||
package collectors
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
@@ -85,6 +78,14 @@ func (m *NUMAStatsCollector) Init(config json.RawMessage) error {
 | 
			
		||||
		"group":  "NUMA",
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	m.config.SendAbsoluteValues = true
 | 
			
		||||
	if len(config) > 0 {
 | 
			
		||||
		err := json.Unmarshal(config, &m.config)
 | 
			
		||||
		if err != nil {
 | 
			
		||||
			return fmt.Errorf("unable to unmarshal numastat configuration: %s", err.Error())
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// Loop for all NUMA node directories
 | 
			
		||||
	base := "/sys/devices/system/node/node"
 | 
			
		||||
	globPattern := base + "[0-9]*"
 | 
			
		||||
@@ -152,11 +153,11 @@ func (m *NUMAStatsCollector) Read(interval time.Duration, output chan lp.CCMessa
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			if m.config.SendAbsoluteValues {
 | 
			
		||||
				msg, err := lp.NewMessage(
 | 
			
		||||
				msg, err := lp.NewMetric(
 | 
			
		||||
					"numastats_"+key,
 | 
			
		||||
					t.tagSet,
 | 
			
		||||
					m.meta,
 | 
			
		||||
					map[string]interface{}{"value": value},
 | 
			
		||||
					value,
 | 
			
		||||
					now,
 | 
			
		||||
				)
 | 
			
		||||
				if err == nil {
 | 
			
		||||
@@ -168,11 +169,11 @@ func (m *NUMAStatsCollector) Read(interval time.Duration, output chan lp.CCMessa
 | 
			
		||||
				prev, ok := t.previousValues[key]
 | 
			
		||||
				if ok {
 | 
			
		||||
					rate := float64(value-prev) / timeDiff
 | 
			
		||||
					msg, err := lp.NewMessage(
 | 
			
		||||
					msg, err := lp.NewMetric(
 | 
			
		||||
						"numastats_"+key+"_rate",
 | 
			
		||||
						t.tagSet,
 | 
			
		||||
						m.meta,
 | 
			
		||||
						map[string]interface{}{"value": rate},
 | 
			
		||||
						rate,
 | 
			
		||||
						now,
 | 
			
		||||
					)
 | 
			
		||||
					if err == nil {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user