diff --git a/pkg/crawler/main.go b/pkg/crawler/main.go index fbd5e48..9b1e9bd 100644 --- a/pkg/crawler/main.go +++ b/pkg/crawler/main.go @@ -65,9 +65,10 @@ type Links struct { } type Power struct { - State string `json:"state,omitempty"` - Mode string `json:"mode,omitempty"` - RestorePolicy string `json:"restore_policy"` + State string `json:"state,omitempty"` + Mode string `json:"mode,omitempty"` + RestorePolicy string `json:"restore_policy"` + PowerControlIDs []string `json:"power_control_ids` } type InventoryDetail struct { @@ -293,6 +294,18 @@ func walkSystems(rf_systems []*redfish.ComputerSystem, rf_chassis *redfish.Chass actions = append(actions, string(action)) } + // get power-related details from rf_chassis + power, err := rf_chassis.Power() + if err != nil { + log.Warn().Err(err).Str("id", rf_computersystem.ID). + Str("system", rf_computersystem.Name).Msg("failed to get power-related details from chassis") + } + // extract the power control odata.id resource + powercontrolIDs := []string{} + for _, rf_powercontrol := range power.PowerControl { + powercontrolIDs = append(powercontrolIDs, rf_powercontrol.ODataID) + } + // get all of the links to the chassis system := InventoryDetail{ URI: baseURI + "/redfish/v1/Systems/" + rf_computersystem.ID, @@ -308,9 +321,10 @@ func walkSystems(rf_systems []*redfish.ComputerSystem, rf_chassis *redfish.Chass Chassis: chassisLinks, }, Power: Power{ - Mode: string(rf_computersystem.PowerMode), - State: string(rf_computersystem.PowerState), - RestorePolicy: string(rf_computersystem.PowerRestorePolicy), + Mode: string(rf_computersystem.PowerMode), + State: string(rf_computersystem.PowerState), + RestorePolicy: string(rf_computersystem.PowerRestorePolicy), + PowerControlIDs: powercontrolIDs, }, Actions: actions, ProcessorCount: rf_computersystem.ProcessorSummary.Count,