Skip to content

Commit

Permalink
Added Support to the Super Micro models
Browse files Browse the repository at this point in the history
  • Loading branch information
scriptinperl authored Jul 25, 2024
1 parent 9264c5b commit 6ac2b78
Showing 1 changed file with 29 additions and 24 deletions.
53 changes: 29 additions & 24 deletions exporter/exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -253,14 +253,17 @@ func NewExporter(ctx context.Context, target, uri, profile, model string, exclud
log.Error("error when getting storage controller metadata", zap.Error(err), zap.Any("trace_id", ctx.Value("traceID")))
return nil, err
}
if controllerOutput.Volumes.URL != "" {
url := appendSlash(controllerOutput.Volumes.URL)
if checkUnique(sysEndpoints.volumes, url) {
sysEndpoints.volumes = append(sysEndpoints.volumes, url)
if len(controllerOutput.Volumes.LinksURLSlice) > 0 {
for _, volume := range controllerOutput.Volumes.LinksURLSlice {
url := appendSlash(volume)
if checkUnique(sysEndpoints.volumes, url) {
sysEndpoints.volumes = append(sysEndpoints.volumes, url)
}
}
}
}
}

if len(sysEndpoints.volumes) > 0 {
for _, volume := range sysEndpoints.volumes {
virtualDrives, err := getMemberUrls(exp.url+volume, target, retryClient)
Expand Down Expand Up @@ -312,10 +315,12 @@ func NewExporter(ctx context.Context, target, uri, profile, model string, exclud
handle(&exp, MEMORY_SUMMARY, STORAGEBATTERY)))

// DIMM endpoints array
dimms, err = getDIMMEndpoints(exp.url+sysEndpoints.systems[0]+"Memory/", target, retryClient)
if err != nil {
log.Error("error when getting DIMM endpoints", zap.Error(err), zap.Any("trace_id", ctx.Value("traceID")))
return nil, err
if sysResp.Memory.URL != "" {
dimms, err = getDIMMEndpoints(exp.url+sysResp.Memory.URL, target, retryClient)
if err != nil {
log.Error("error when getting DIMM endpoints", zap.Error(err), zap.Any("trace_id", ctx.Value("traceID")))
return nil, err
}
}

// CPU processor metrics
Expand Down Expand Up @@ -377,7 +382,22 @@ func NewExporter(ctx context.Context, target, uri, profile, model string, exclud
}
} else {
log.Error("error when getting Firmware endpoints", zap.Error(err), zap.Any("trace_id", ctx.Value("traceID")))
return nil, err
//return nil, err
}
} else {
// Firmware Inventory
// To avoid scraping a large number of firmware endpoints, we will only scrape if there are less than 75 members
if len(firmwareInventoryEndpoints.Members) < 75 {
for _, fwEp := range firmwareInventoryEndpoints.Members {
// this list can potentially be large and cause scrapes to take a long time
// see the '--collector.firmware.modules-exclude' config in the README for more information
if reg, ok := excludes["firmware"]; ok {
if !reg.(*regexp.Regexp).MatchString(fwEp.URL) {
tasks = append(tasks,
pool.NewTask(common.Fetch(exp.url+fwEp.URL, target, profile, retryClient), exp.url+fwEp.URL, handle(&exp, FIRMWAREINVENTORY)))
}
}
}
}
}

Expand Down Expand Up @@ -425,21 +445,6 @@ func NewExporter(ctx context.Context, target, uri, profile, model string, exclud
pool.NewTask(common.Fetch(exp.url+dimm.URL, target, profile, retryClient), exp.url+dimm.URL, handle(&exp, MEMORY)))
}

// Firmware Inventory
// To avoid scraping a large number of firmware endpoints, we will only scrape if there are less than 75 members
if len(firmwareInventoryEndpoints.Members) < 75 {
for _, fwEp := range firmwareInventoryEndpoints.Members {
// this list can potentially be large and cause scrapes to take a long time
// see the '--collector.firmware.modules-exclude' config in the README for more information
if reg, ok := excludes["firmware"]; ok {
if !reg.(*regexp.Regexp).MatchString(fwEp.URL) {
tasks = append(tasks,
pool.NewTask(common.Fetch(exp.url+fwEp.URL, target, profile, retryClient), exp.url+fwEp.URL, handle(&exp, FIRMWAREINVENTORY)))
}
}
}
}

// call /redfish/v1/Managers/XXX/ for firmware version and ilo self test metrics
tasks = append(tasks,
pool.NewTask(common.Fetch(exp.url+mgrEndpointFinal, target, profile, retryClient),
Expand Down

0 comments on commit 6ac2b78

Please sign in to comment.