mirror of
https://github.com/ClusterCockpit/cc-metric-collector.git
synced 2025-06-17 21:13:48 +02:00
This commit is contained in:
parent
4c7a0e064f
commit
b9665d0d68
@ -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
|
package collectors
|
||||||
|
|
||||||
import (
|
import (
|
||||||
@ -85,6 +78,14 @@ func (m *NUMAStatsCollector) Init(config json.RawMessage) error {
|
|||||||
"group": "NUMA",
|
"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
|
// Loop for all NUMA node directories
|
||||||
base := "/sys/devices/system/node/node"
|
base := "/sys/devices/system/node/node"
|
||||||
globPattern := base + "[0-9]*"
|
globPattern := base + "[0-9]*"
|
||||||
@ -152,11 +153,11 @@ func (m *NUMAStatsCollector) Read(interval time.Duration, output chan lp.CCMessa
|
|||||||
}
|
}
|
||||||
|
|
||||||
if m.config.SendAbsoluteValues {
|
if m.config.SendAbsoluteValues {
|
||||||
msg, err := lp.NewMessage(
|
msg, err := lp.NewMetric(
|
||||||
"numastats_"+key,
|
"numastats_"+key,
|
||||||
t.tagSet,
|
t.tagSet,
|
||||||
m.meta,
|
m.meta,
|
||||||
map[string]interface{}{"value": value},
|
value,
|
||||||
now,
|
now,
|
||||||
)
|
)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
@ -168,11 +169,11 @@ func (m *NUMAStatsCollector) Read(interval time.Duration, output chan lp.CCMessa
|
|||||||
prev, ok := t.previousValues[key]
|
prev, ok := t.previousValues[key]
|
||||||
if ok {
|
if ok {
|
||||||
rate := float64(value-prev) / timeDiff
|
rate := float64(value-prev) / timeDiff
|
||||||
msg, err := lp.NewMessage(
|
msg, err := lp.NewMetric(
|
||||||
"numastats_"+key+"_rate",
|
"numastats_"+key+"_rate",
|
||||||
t.tagSet,
|
t.tagSet,
|
||||||
m.meta,
|
m.meta,
|
||||||
map[string]interface{}{"value": rate},
|
rate,
|
||||||
now,
|
now,
|
||||||
)
|
)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user