mirror of
				https://github.com/ClusterCockpit/cc-metric-collector.git
				synced 2025-11-04 02:35:07 +01:00 
			
		
		
		
	Collector-specific configuration. LIKWID collector derives metrics itself, Run once CLI option
This commit is contained in:
		@@ -7,11 +7,12 @@ import (
 | 
			
		||||
	"strconv"
 | 
			
		||||
	"strings"
 | 
			
		||||
	"time"
 | 
			
		||||
	"errors"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
type MetricGetter interface {
 | 
			
		||||
	Name() string
 | 
			
		||||
	Init() error
 | 
			
		||||
	Init(config []byte) error
 | 
			
		||||
	Read(time.Duration, *[]lp.MutableMetric)
 | 
			
		||||
	Close()
 | 
			
		||||
	//	GetNodeMetric() map[string]interface{}
 | 
			
		||||
@@ -67,6 +68,15 @@ func intArrayContains(array []int, str int) (int, bool) {
 | 
			
		||||
	return -1, false
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func stringArrayContains(array []string, str string) (int, bool) {
 | 
			
		||||
    for i, a := range array {
 | 
			
		||||
		if a == str {
 | 
			
		||||
			return i, true
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	return -1, false
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func SocketList() []int {
 | 
			
		||||
	buffer, err := ioutil.ReadFile("/proc/cpuinfo")
 | 
			
		||||
	if err != nil {
 | 
			
		||||
@@ -132,3 +142,13 @@ func Fields2Map(metric lp.Metric) map[string]interface{} {
 | 
			
		||||
	}
 | 
			
		||||
	return fields
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func RemoveFromStringList(s []string, r string) ([]string, error) {
 | 
			
		||||
    for i, item := range s {
 | 
			
		||||
        if r == item {
 | 
			
		||||
            return append(s[:i], s[i+1:]...), nil
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    return s, errors.New("No such string in list")
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user