Skip to content

Commit

Permalink
firmware collection and device info metric name fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ibrahimkk-moideen committed Apr 5, 2024
1 parent 3ab48ea commit 842460a
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 13 deletions.
10 changes: 5 additions & 5 deletions hpe/dl360/exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ type Exporter struct {
credProfile string
biosVersion string
chassisSerialNumber string
iloServerName string
deviceMetrics *map[string]*metrics
}

Expand Down Expand Up @@ -177,6 +178,7 @@ func NewExporter(ctx context.Context, target, uri, profile string) (*Exporter, e
}
exp.biosVersion = resp.BiosVersion
exp.chassisSerialNumber = resp.SerialNumber
exp.iloServerName = resp.IloServerName

// vars for drive parsing
var (
Expand Down Expand Up @@ -309,14 +311,12 @@ func NewExporter(ctx context.Context, target, uri, profile string) (*Exporter, e
return nil, err
}

tasks = append(tasks,
pool.NewTask(common.Fetch(fqdn.String()+uri+"/Managers/1", FIRMWARE, target, profile, retryClient)))

// Additional tasks for pool to perform
tasks = append(tasks,
pool.NewTask(common.Fetch(fqdn.String()+uri+"/Chassis/1/Thermal/", THERMAL, target, profile, retryClient)),
pool.NewTask(common.Fetch(fqdn.String()+uri+"/Chassis/1/Power/", POWER, target, profile, retryClient)),
pool.NewTask(common.Fetch(fqdn.String()+uri+"/Systems/1/", MEMORY_SUMMARY, target, profile, retryClient)))
pool.NewTask(common.Fetch(fqdn.String()+uri+"/Systems/1/", MEMORY_SUMMARY, target, profile, retryClient)),
pool.NewTask(common.Fetch(fqdn.String()+uri+"/Managers/1/", FIRMWARE, target, profile, retryClient)))

// DIMMs
for _, dimm := range dimms.Members {
Expand Down Expand Up @@ -474,7 +474,7 @@ func (e *Exporter) exportFirmwareMetrics(body []byte) error {
return fmt.Errorf("Error Unmarshalling DL360 FirmwareMetrics - " + err.Error())
}

(*dm)["deviceInfo"].WithLabelValues(chas.Description, e.chassisSerialNumber, chas.FirmwareVersion, e.biosVersion, DL360).Set(1.0)
(*dm)["deviceInfo"].WithLabelValues(e.iloServerName, e.chassisSerialNumber, chas.FirmwareVersion, e.biosVersion, DL360).Set(1.0)

return nil
}
Expand Down
7 changes: 5 additions & 2 deletions hpe/dl380/exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ type Exporter struct {
credProfile string
biosVersion string
chassisSerialNumber string
iloServerName string
deviceMetrics *map[string]*metrics
}

Expand Down Expand Up @@ -171,6 +172,7 @@ func NewExporter(ctx context.Context, target, uri, profile string) (*Exporter, e
}
exp.biosVersion = resp.BiosVersion
exp.chassisSerialNumber = resp.SerialNumber
exp.iloServerName = resp.IloServerName

// vars for drive parsing
var (
Expand Down Expand Up @@ -305,7 +307,8 @@ func NewExporter(ctx context.Context, target, uri, profile string) (*Exporter, e
tasks = append(tasks,
pool.NewTask(common.Fetch(fqdn.String()+uri+"/Chassis/1/Thermal/", THERMAL, target, profile, retryClient)),
pool.NewTask(common.Fetch(fqdn.String()+uri+"/Chassis/1/Power/", POWER, target, profile, retryClient)),
pool.NewTask(common.Fetch(fqdn.String()+uri+"/Systems/1/", MEMORY_SUMMARY, target, profile, retryClient)))
pool.NewTask(common.Fetch(fqdn.String()+uri+"/Systems/1/", MEMORY_SUMMARY, target, profile, retryClient)),
pool.NewTask(common.Fetch(fqdn.String()+uri+"/Managers/1/", FIRMWARE, target, profile, retryClient)))

// DIMMs
for _, dimm := range dimms.Members {
Expand Down Expand Up @@ -442,7 +445,7 @@ func (e *Exporter) exportFirmwareMetrics(body []byte) error {
return fmt.Errorf("Error Unmarshalling DL380 FirmwareMetrics - " + err.Error())
}

(*dm)["deviceInfo"].WithLabelValues(chas.Description, e.chassisSerialNumber, chas.FirmwareVersion, e.biosVersion, DL380).Set(1.0)
(*dm)["deviceInfo"].WithLabelValues(e.iloServerName, e.chassisSerialNumber, chas.FirmwareVersion, e.biosVersion, DL380).Set(1.0)

return nil
}
Expand Down
6 changes: 4 additions & 2 deletions hpe/dl560/exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ type Exporter struct {
credProfile string
biosVersion string
chassisSerialNumber string
iloServerName string
deviceMetrics *map[string]*metrics
}

Expand Down Expand Up @@ -171,6 +172,7 @@ func NewExporter(ctx context.Context, target, uri, profile string) (*Exporter, e
}
exp.biosVersion = resp.BiosVersion
exp.chassisSerialNumber = resp.SerialNumber
exp.iloServerName = resp.IloServerName

// vars for drive parsing
var (
Expand Down Expand Up @@ -298,7 +300,7 @@ func NewExporter(ctx context.Context, target, uri, profile string) (*Exporter, e
pool.NewTask(common.Fetch(fqdn.String()+uri+"/Chassis/1/Thermal/", THERMAL, target, profile, retryClient)),
pool.NewTask(common.Fetch(fqdn.String()+uri+"/Chassis/1/Power/", POWER, target, profile, retryClient)),
pool.NewTask(common.Fetch(fqdn.String()+uri+"/Systems/1/", MEMORY_SUMMARY, target, profile, retryClient)),
)
pool.NewTask(common.Fetch(fqdn.String()+uri+"/Managers/1/", FIRMWARE, target, profile, retryClient)))

// DIMMs
for _, dimm := range dimms.Members {
Expand Down Expand Up @@ -435,7 +437,7 @@ func (e *Exporter) exportFirmwareMetrics(body []byte) error {
return fmt.Errorf("Error Unmarshalling DL560 FirmwareMetrics - " + err.Error())
}

(*dm)["deviceInfo"].WithLabelValues(chas.Description, e.chassisSerialNumber, chas.FirmwareVersion, e.biosVersion, DL560).Set(1.0)
(*dm)["deviceInfo"].WithLabelValues(e.iloServerName, e.chassisSerialNumber, chas.FirmwareVersion, e.biosVersion, DL560).Set(1.0)

return nil
}
Expand Down
7 changes: 5 additions & 2 deletions hpe/xl420/exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ type Exporter struct {
credProfile string
biosVersion string
chassisSerialNumber string
iloServerName string
deviceMetrics *map[string]*metrics
}

Expand Down Expand Up @@ -177,6 +178,7 @@ func NewExporter(ctx context.Context, target, uri, profile string) (*Exporter, e
}
exp.biosVersion = resp.BiosVersion
exp.chassisSerialNumber = resp.SerialNumber
exp.iloServerName = resp.IloServerName

// vars for drive parsing
var (
Expand Down Expand Up @@ -312,7 +314,8 @@ func NewExporter(ctx context.Context, target, uri, profile string) (*Exporter, e
tasks = append(tasks,
pool.NewTask(common.Fetch(fqdn.String()+uri+"/Chassis/1/Thermal/", THERMAL, target, profile, retryClient)),
pool.NewTask(common.Fetch(fqdn.String()+uri+"/Chassis/1/Power/", POWER, target, profile, retryClient)),
pool.NewTask(common.Fetch(fqdn.String()+uri+"/Systems/1/", MEMORY_SUMMARY, target, profile, retryClient)))
pool.NewTask(common.Fetch(fqdn.String()+uri+"/Systems/1/", MEMORY_SUMMARY, target, profile, retryClient)),
pool.NewTask(common.Fetch(fqdn.String()+uri+"/Managers/1/", FIRMWARE, target, profile, retryClient)))

// DIMMs
for _, dimm := range dimms.Members {
Expand Down Expand Up @@ -470,7 +473,7 @@ func (e *Exporter) exportFirmwareMetrics(body []byte) error {
return fmt.Errorf("Error Unmarshalling XL420 FirmwareMetrics - " + err.Error())
}

(*dm)["deviceInfo"].WithLabelValues(chas.Description, e.chassisSerialNumber, chas.FirmwareVersion, e.biosVersion, XL420).Set(1.0)
(*dm)["deviceInfo"].WithLabelValues(e.iloServerName, e.chassisSerialNumber, chas.FirmwareVersion, e.biosVersion, XL420).Set(1.0)

return nil
}
Expand Down
5 changes: 3 additions & 2 deletions oem/chassis.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,9 @@ type Status struct {

// ServerManager contains the BIOS version and Serial number of the chassis
type ServerManager struct {
BiosVersion string `json:"BiosVersion"`
SerialNumber string `json:"SerialNumber"`
BiosVersion string `json:"BiosVersion"`
SerialNumber string `json:"SerialNumber"`
IloServerName string `json:"HostName"`
}

// /redfish/v1/Chassis/CMC
Expand Down

0 comments on commit 842460a

Please sign in to comment.