Module: ILO_SDK::ChassisHelper
- Included in:
- Client
- Defined in:
- lib/ilo-sdk/helpers/chassis_helper.rb
Overview
Contains helper methods for Chassis actions
Instance Method Summary collapse
-
#get_power_metrics ⇒ Hash
Get the power metrics.
-
#get_thermal_metrics ⇒ Hash
Get the thermal metrics.
Instance Method Details
#get_power_metrics ⇒ Hash
Get the power metrics
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/ilo-sdk/helpers/chassis_helper.rb', line 18 def get_power_metrics chassis = rest_get('/redfish/v1/Chassis/') chassis_uri = response_handler(chassis)['links']['Member'][0]['href'] power_metrics_uri = response_handler(rest_get(chassis_uri))['links']['PowerMetrics']['href'] response = rest_get(power_metrics_uri) metrics = response_handler(response) power_supplies = [] metrics['PowerSupplies'].each do |ps| power_supply = { 'LineInputVoltage' => ps['LineInputVoltage'], 'LineInputVoltageType' => ps['LineInputVoltageType'], 'PowerCapacityWatts' => ps['PowerCapacityWatts'], 'PowerSupplyType' => ps['PowerSupplyType'], 'Health' => ps['Status']['Health'], 'State' => ps['Status']['State'] } power_supplies.push(power_supply) end { @host => { 'PowerCapacityWatts' => metrics['PowerCapacityWatts'], 'PowerConsumedWatts' => metrics['PowerConsumedWatts'], 'PowerSupplies' => power_supplies } } end |
#get_thermal_metrics ⇒ Hash
Get the thermal metrics
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/ilo-sdk/helpers/chassis_helper.rb', line 48 def get_thermal_metrics chassis = rest_get('/redfish/v1/Chassis/') chassis_uri = response_handler(chassis)['links']['Member'][0]['href'] thermal_metrics_uri = response_handler(rest_get(chassis_uri))['links']['ThermalMetrics']['href'] response = rest_get(thermal_metrics_uri) temperatures = response_handler(response)['Temperatures'] temp_details = [] temperatures.each do |temp| temp_detail = { 'PhysicalContext' => temp['PhysicalContext'], 'Name' => temp['Name'], 'CurrentReading' => temp['ReadingCelsius'], 'CriticalThreshold' => temp['LowerThresholdCritical'], 'Health' => temp['Status']['Health'], 'State' => temp['Status']['State'] } temp_details.push(temp_detail) end { @host => temp_details } end |