redfish api


redfish是新一代的帶外管理協議。通過restful api,抽象統一各服務器廠商的帶外管理操作。
雖然如此,但各廠商對redfish的支持程度不一。所以,不同廠商對redfish的操作方式與報文格式依然存在小部分差異。甚至有一些型號的服務器不支持redfish。
所以,上新型號服務器前,必須確認是否支持redfish,協議是否需要重新適配。
 
驗證機型:
華為 2288H V5
 
華為redfish文檔
 
步驟:
1.獲取token api
curl -i -k --request POST -H "Content-Type: application/json" -d '{"UserName" : "xxxxxxx","Password" : "xxxxx"}'  https://${帶外ip地址}/redfish/v1/SessionService/Sessions && echo
從返回報文頭中,獲取X-Auth-Token和Location。
X-Auth-Token:用於后續請求
Location:記錄本次session id,用於操作完成后,清除session
 
2.獲取服務器硬件信息

 

名稱
uri
method
響應報文子對象
說明
獲取token
/redfish/v1/SessionService/Sessions
post
 
 
獲取內存列表
/redfish/v1/Systems/1/Memory
get
Members
Members記錄了內存列表各自的URI。

 

"Members": [
{
"@ odata.id": "/redfish/v1/Systems/1/Memory/proc1dimm1"
},
{
"@ odata.id": "/redfish/v1/Systems/1/Memory/proc1dimm2"
}
]
獲取內存詳情
/redfish/v1/Systems/1/Memory/${menId}
get
 
/redfish/v1/Systems/1/Memory/proc1dimm1
獲取cpu列表
/redfish/v1/Systems/1/Processors
get
Members
"Members": [
{
"@ odata.id": "/redfish/v1/Systems/1/Processors/1"
},
{
"@ odata.id": "/redfish/v1/Systems/1/Processors/2"
}
]
獲取cpu詳情
/redfish/v1/Systems/1/Processors/${cpuId}
get
 
/redfish/v1/Systems/1/Processors/1
獲取電源列表
/redfish/v1/Chassis/1/Power
get
PowerSupplies

 

"PowerSupplies": [
{
"@ odata.id": "/redfish/v1/Chassis/1/Power#/PowerSupplies/0",
"MemberId": "0",
"Name": "PS1",
"Status": {
"State": "Enabled",
"Health": "OK"
},
"PowerSupplyType": "AC",
"LineInputVoltage": 221,
"PowerCapacityWatts": 550,
"Model": "PAC550S12-BE",
"FirmwareVersion": "DC:112 PFC:112",
"SerialNumber": "2102312DEP10LC014972",
"Redundancy": [
{
"@ odata.id": "/redfish/v1/Chassis/1/Power#/Redundancy/0"
}
],
"Manufacturer": "HUAWEI",
"PartNumber": "02312DEP",
"Oem": {
"Huawei": {
"Protocol": "PSU",
"ActiveStandby": "Active",
"PowerInputWatts": 18,
"InputAmperage": 0.00125,
"PowerOutputWatts": 11,
"OutputAmperage": 0.02265625,
"OutputVoltage": 0.02734375,
"DeviceLocator": "PS1",
"SlotNumber": 1,
"Position": "chassis"
}
}
}
]
獲取風扇列表
/redfish/v1/Chassis/1/Thermal
get
Fans

 

"Fans": [
{
"@ odata.id": "/redfish/v1/Chassis/1/Thermal#/Fans/0",
"MemberId": "0",
"Name": "Fan Module1 Front",
"Reading": null,
"LowerThresholdNonCritical": null,
"LowerThresholdCritical": null,
"LowerThresholdFatal": null,
"UpperThresholdNonCritical": null,
"UpperThresholdCritical": null,
"UpperThresholdFatal": null,
"MinReadingRange": null,
"MaxReadingRange": null,
"Status": {
"State": "Enabled",
"Health": "OK"
},
"ReadingUnits": "RPM",
"PartNumber": "02311VSF",
"Oem": {
"Huawei": {
"Position": "chassis",
"SpeedRatio": 0,
"SlotNumber": 1
}
}
},
{
"@ odata.id": "/redfish/v1/Chassis/1/Thermal#/Fans/1",
"MemberId": "1",
"Name": "Fan Module2 Front",
"Reading": null,
"LowerThresholdNonCritical": null,
"LowerThresholdCritical": null,
"LowerThresholdFatal": null,
"UpperThresholdNonCritical": null,
"UpperThresholdCritical": null,
"UpperThresholdFatal": null,
"MinReadingRange": null,
"MaxReadingRange": null,
"Status": {
"State": "Enabled",
"Health": "OK"
},
"ReadingUnits": "RPM",
"PartNumber": "02311VSF",
"Oem": {
"Huawei": {
"Position": "chassis",
"SpeedRatio": 0,
"SlotNumber": 2
}
}
}
]
刪除token
/redfish/v1/SessionService/Sessions/${sessionId}
delete
 
/redfish/v1/SessionService/Sessions/2062248c80b4e8eb
URI地址來源:“獲取token”響應報文中的Location頭信息。
華為服務器Location頭信息是URI;HPE服務器Location頭信息是完整的URL


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM