mirror of
https://github.com/ClusterCockpit/cc-metric-collector.git
synced 2026-06-30 15:20:38 +02:00
Logic error, move creation of map upwards
This commit is contained in:
committed by
Thomas Gruber
parent
9677a916be
commit
14d624fd22
@@ -66,6 +66,15 @@ func (m *IpmiCollector) Init(config json.RawMessage) error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Read metrics to include
|
||||||
|
m.includeMetrics = make(map[string]bool)
|
||||||
|
for _, metric := range m.config.IncludeMetrics {
|
||||||
|
metric = strings.ToLower(strings.TrimSpace(metric))
|
||||||
|
if metric != "" {
|
||||||
|
m.includeMetrics[metric] = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
m.ipmitool = m.config.IpmitoolPath
|
m.ipmitool = m.config.IpmitoolPath
|
||||||
m.ipmisensors = m.config.IpmisensorsPath
|
m.ipmisensors = m.config.IpmisensorsPath
|
||||||
|
|
||||||
@@ -108,15 +117,6 @@ func (m *IpmiCollector) Init(config json.RawMessage) error {
|
|||||||
m.ipmitool = ""
|
m.ipmitool = ""
|
||||||
cclog.ComponentDebugf(m.name, "Unable to use ipmitool for ipmistat collector: %v", ipmiToolErr)
|
cclog.ComponentDebugf(m.name, "Unable to use ipmitool for ipmistat collector: %v", ipmiToolErr)
|
||||||
|
|
||||||
// read metrics to include
|
|
||||||
m.includeMetrics = make(map[string]bool)
|
|
||||||
for _, metric := range m.config.IncludeMetrics {
|
|
||||||
metric = strings.ToLower(strings.TrimSpace(metric))
|
|
||||||
if metric != "" {
|
|
||||||
m.includeMetrics[metric] = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return fmt.Errorf("unable to init neither ipmitool (%w) nor ipmi-sensors (%w)", ipmiToolErr, ipmiSensorsErr)
|
return fmt.Errorf("unable to init neither ipmitool (%w) nor ipmi-sensors (%w)", ipmiToolErr, ipmiSensorsErr)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user