mirror of
https://github.com/ClusterCockpit/cc-metric-collector.git
synced 2024-12-25 15:09:05 +01:00
Return error at Init for skip collectors early
This commit is contained in:
parent
9b59429a93
commit
6b6e28d4c7
@ -13,9 +13,10 @@ type CpustatCollector struct {
|
||||
MetricCollector
|
||||
}
|
||||
|
||||
func (m *CpustatCollector) Init() {
|
||||
func (m *CpustatCollector) Init() error {
|
||||
m.name = "CpustatCollector"
|
||||
m.setup()
|
||||
return nil
|
||||
}
|
||||
|
||||
func ParseStatLine(line string, out map[string]interface{}) {
|
||||
|
@ -16,9 +16,11 @@ type InfinibandCollector struct {
|
||||
MetricCollector
|
||||
}
|
||||
|
||||
func (m *InfinibandCollector) Init() {
|
||||
func (m *InfinibandCollector) Init() error {
|
||||
m.name = "InfinibandCollector"
|
||||
m.setup()
|
||||
_, err := ioutil.ReadFile(string(LIDFILE))
|
||||
return err
|
||||
}
|
||||
|
||||
func (m *InfinibandCollector) Read(interval time.Duration) {
|
||||
|
@ -71,7 +71,7 @@ func getSocketCpus() map[C.int]int {
|
||||
return outmap
|
||||
}
|
||||
|
||||
func (m *LikwidCollector) Init() {
|
||||
func (m *LikwidCollector) Init() error {
|
||||
m.name = "LikwidCollector"
|
||||
m.setup()
|
||||
cpulist := CpuList()
|
||||
@ -111,6 +111,7 @@ func (m *LikwidCollector) Init() {
|
||||
}
|
||||
C.free(unsafe.Pointer(cstr))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *LikwidCollector) Read(interval time.Duration) {
|
||||
|
@ -13,9 +13,10 @@ type LoadavgCollector struct {
|
||||
MetricCollector
|
||||
}
|
||||
|
||||
func (m *LoadavgCollector) Init() {
|
||||
func (m *LoadavgCollector) Init() error {
|
||||
m.name = "LoadavgCollector"
|
||||
m.setup()
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *LoadavgCollector) Read(interval time.Duration) {
|
||||
|
@ -14,9 +14,11 @@ type LustreCollector struct {
|
||||
MetricCollector
|
||||
}
|
||||
|
||||
func (m *LustreCollector) Init() {
|
||||
func (m *LustreCollector) Init() error {
|
||||
m.name = "LustreCollector"
|
||||
m.setup()
|
||||
_, err := ioutil.ReadFile(string(LUSTREFILE))
|
||||
return err
|
||||
}
|
||||
|
||||
func (m *LustreCollector) Read(interval time.Duration) {
|
||||
|
@ -15,9 +15,10 @@ type MemstatCollector struct {
|
||||
MetricCollector
|
||||
}
|
||||
|
||||
func (m *MemstatCollector) Init() {
|
||||
func (m *MemstatCollector) Init() error {
|
||||
m.name = "MemstatCollector"
|
||||
m.setup()
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *MemstatCollector) Read(interval time.Duration) {
|
||||
|
@ -10,7 +10,7 @@ import (
|
||||
|
||||
type MetricGetter interface {
|
||||
Name() string
|
||||
Init()
|
||||
Init() error
|
||||
Read(time.Duration)
|
||||
Close()
|
||||
GetNodeMetric() map[string]interface{}
|
||||
|
@ -15,9 +15,10 @@ type NetstatCollector struct {
|
||||
MetricCollector
|
||||
}
|
||||
|
||||
func (m *NetstatCollector) Init() {
|
||||
func (m *NetstatCollector) Init() error {
|
||||
m.name = "NetstatCollector"
|
||||
m.setup()
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *NetstatCollector) Read(interval time.Duration) {
|
||||
|
@ -14,9 +14,10 @@ type TopProcsCollector struct {
|
||||
MetricCollector
|
||||
}
|
||||
|
||||
func (m *TopProcsCollector) Init() {
|
||||
func (m *TopProcsCollector) Init() error {
|
||||
m.name = "TopProcsCollector"
|
||||
m.setup()
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *TopProcsCollector) Read(interval time.Duration) {
|
||||
|
Loading…
Reference in New Issue
Block a user