zoukankan      html  css  js  c++  java
  • 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
  • 相关阅读:
    简单工厂、工厂方法和抽象工厂的学习笔记
    单一职责原则,开-闭原则,依赖倒置原则
    我对面向对象设计的理解——Java接口和Java抽象类
    高可用与负载均衡的区别
    应用交付、负载均衡(Load balancing)、高可用、F5
    四种常见的 POST 提交数据方式
    Git fetch和git pull的区别
    苹果Mac OS X显示隐藏文件的方法
    Appium教程---Client/Server Architecture
    UNIX网络编程——使用线程的TCP回射服务器程序
  • 原文地址:https://www.cnblogs.com/danny-djy/p/14694705.html
Copyright © 2011-2022 走看看