mirror of
https://github.com/ClusterCockpit/cc-metric-collector.git
synced 2025-01-12 15:19:06 +01:00
Refactoring: Use array of pointers
This commit is contained in:
parent
d6154ff35b
commit
542520d2c0
@ -6,6 +6,7 @@
|
|||||||
"test_fs"
|
"test_fs"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"ibstat": {},
|
||||||
"loadavg": {
|
"loadavg": {
|
||||||
"exclude_metrics": [
|
"exclude_metrics": [
|
||||||
"proc_total"
|
"proc_total"
|
||||||
|
@ -31,7 +31,7 @@ type InfinibandCollector struct {
|
|||||||
config struct {
|
config struct {
|
||||||
ExcludeDevices []string `json:"exclude_devices,omitempty"` // IB device to exclude e.g. mlx5_0
|
ExcludeDevices []string `json:"exclude_devices,omitempty"` // IB device to exclude e.g. mlx5_0
|
||||||
}
|
}
|
||||||
info []InfinibandCollectorInfo
|
info []*InfinibandCollectorInfo
|
||||||
}
|
}
|
||||||
|
|
||||||
// Init initializes the Infiniband collector by walking through files below IB_BASEPATH
|
// Init initializes the Infiniband collector by walking through files below IB_BASEPATH
|
||||||
@ -111,7 +111,7 @@ func (m *InfinibandCollector) Init(config json.RawMessage) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
m.info = append(m.info,
|
m.info = append(m.info,
|
||||||
InfinibandCollectorInfo{
|
&InfinibandCollectorInfo{
|
||||||
LID: LID,
|
LID: LID,
|
||||||
device: device,
|
device: device,
|
||||||
port: port,
|
port: port,
|
||||||
@ -142,10 +142,7 @@ func (m *InfinibandCollector) Read(interval time.Duration, output chan lp.CCMetr
|
|||||||
}
|
}
|
||||||
|
|
||||||
now := time.Now()
|
now := time.Now()
|
||||||
for i := range m.info {
|
for _, info := range m.info {
|
||||||
|
|
||||||
// device info
|
|
||||||
info := &m.info[i]
|
|
||||||
for counterName, counterFile := range info.portCounterFiles {
|
for counterName, counterFile := range info.portCounterFiles {
|
||||||
line, err := ioutil.ReadFile(counterFile)
|
line, err := ioutil.ReadFile(counterFile)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user