Quantcast
Channel: 钻戒 and 仁豆米
Viewing all articles
Browse latest Browse all 290

Dell的idrac redfish初探

$
0
0

各大主板厂商纷纷支持下一代带外管理标准redfish。

其实Dell的idrac管理做的是相当好的,那么来看看对redfish的支持吧。

先看看v1都有什么命令

curl -s  "https://10.16.24.15/redfish/v1" -k -u root:alibaba | jq .  
结果如下:
{
  "@odata.context": "/redfish/v1/$metadata#ServiceRoot.ServiceRoot",
  "@odata.id": "/redfish/v1",
  "@odata.type": "#ServiceRoot.v1_1_0.ServiceRoot",
  "AccountService": {
    "@odata.id": "/redfish/v1/Managers/iDRAC.Embedded.1/AccountService"
  },
  "Chassis": {
    "@odata.id": "/redfish/v1/Chassis"
  },
  "Description": "Root Service",
  "EventService": {
    "@odata.id": "/redfish/v1/EventService"
  },
  "Id": "RootService",
  "JsonSchemas": {
    "@odata.id": "/redfish/v1/JSONSchemas"
  },
  "Links": {
    "Sessions": {
      "@odata.id": "/redfish/v1/Sessions"
    }
  },
  "Managers": {
    "@odata.id": "/redfish/v1/Managers"
  },
  "Name": "Root Service",
  "Oem": {
    "Dell": {
      "@odata.type": "#DellServiceRoot.v1_0_0.ServiceRootSummary",
      "IsBranded": 0,
      "ManagerMACAddress": "50:9A:4C:82:B9:3F",
      "ServiceTag": "7Q9N8P2"
    }
  },
  "RedfishVersion": "1.0.2",
  "Registries": {
    "@odata.id": "/redfish/v1/Registries"
  },
  "SessionService": {
    "@odata.id": "/redfish/v1/SessionService"
  },
  "Systems": {
    "@odata.id": "/redfish/v1/Systems"
  },
  "Tasks": {
    "@odata.id": "/redfish/v1/TaskService"
  },
  "UpdateService": {
    "@odata.id": "/redfish/v1/UpdateService"
  }
}

好多服务撒,挑一个看看

curl -s  "https://10.16.24.15/redfish/v1/Chassis" -k -u root:alibaba | jq .  
结果如下:
{
  "@odata.context": "/redfish/v1/$metadata#ChassisCollection.ChassisCollection",
  "@odata.id": "/redfish/v1/Chassis/",
  "@odata.type": "#ChassisCollection.ChassisCollection",
  "Description": "Collection of Chassis",
  "Members": [
    {
      "@odata.id": "/redfish/v1/Chassis/System.Embedded.1"
    },
    {
      "@odata.id": "/redfish/v1/Chassis/Enclosure.Internal.0-1:RAID.Integrated.1-1"
    }
  ],
  "Members@odata.count": 2,
  "Name": "Chassis Collection"
}

试试Session的管理:

curl -v -k -X POST -d '{"UserName":"root","Password":"alibaba"}' -H "Content-Type: application/json" https://10.16.24.15/redfish/v1/Sessions   | jq .  

注意Dell官方的文档里居然不提json的事,直接用它给的命令会报错的,post的数据明显是个json。

结果:
* About to connect() to 10.16.24.15 port 443 (#0)
*   Trying 10.16.24.15... connected
* Connected to 10.16.24.15 (10.16.24.15) port 443 (#0)
* Initializing NSS with certpath: sql:/etc/pki/nssdb
* warning: ignoring value of ssl.verifyhost
* skipping SSL peer certificate verification
* SSL connection using TLS_DHE_RSA_WITH_AES_128_GCM_SHA256
* Server certificate:
*     subject: E=support@dell.com,CN=idrac-7Q9N8P2,OU=Remote Access Group,O=Dell Inc.,L=Round Rock,ST=Texas,C=US
*     start date: Mar 15 06:13:00 2018 GMT
*     expire date: Mar 15 06:14:22 2028 GMT
*     common name: idrac-7Q9N8P2
*     issuer: E=support@dell.com,CN=idrac-7Q9N8P2,OU=Remote Access Group,O=Dell Inc.,L=Round Rock,ST=Texas,C=US
> POST /redfish/v1/Sessions HTTP/1.1
> User-Agent: curl/7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.21 Basic ECC zlib/1.2.3 libidn/1.18 libssh2/1.4.2
> Host: 10.16.24.15
> Accept: */*
> Content-Type: application/json
> Content-Length: 39
> 
} [data not shown]
< HTTP/1.1 201 Created  
< OData-Version: 4.0  
< Keep-Alive: timeout=60, max=199  
< Content-Type: application/json;odata.metadata=minimal;charset=utf-8  
< Server: iDRAC/8  
< Location: /redfish/v1/Sessions/13  
< Date: Wed, 05 Sep 2018 08:26:55 GMT  
< X-Auth-Token: d42c621ee25ad8b49c0d24bbd763f54f  
< Cache-Control: no-cache  
< Content-Length: 745  
< Connection: Keep-Alive  
< Access-Control-Allow-Origin: *  
< Accept-Ranges: bytes  
<  
{ [data not shown]
* Connection #0 to host 10.16.24.15 left intact
* Closing connection #0
{
  "@Message.ExtendedInfo": [
    {
      "Message": "The resource has been created successfully",
      "MessageArgs": [],
      "MessageArgs@odata.count": 0,
      "MessageId": "Base.1.0.Created",
      "RelatedProperties": [],
      "RelatedProperties@odata.count": 0,
      "Resolution": "None",
      "Severity": "OK"
    },
    {
      "Message": "A new resource is successfully created.",
      "MessageArgs": [],
      "MessageArgs@odata.count": 0,
      "MessageId": "IDRAC.1.6.SYS414",
      "RelatedProperties": [],
      "RelatedProperties@odata.count": 0,
      "Resolution": "No response action is required.",
      "Severity": "Informational"
    }
  ],
  "@odata.context": "/redfish/v1/$metadata#Session.Session",
  "@odata.id": "/redfish/v1/Sessions/13",
  "@odata.type": "#Session.v1_0_2.Session",
  "Description": "User Session",
  "Id": "13",
  "Name": "User Session",
  "Password": null,
  "UserName": "root"
}

记下这行:X-Auth-Token: d42c621ee25ad8b49c0d24bbd763f54f

试试这种Session的功效

curl -k https://10.16.24.15/redfish/v1/Chassis -s --header "X-Auth-Token: d42c621ee25ad8b49c0d24bbd763f54f" | jq .  
结果:
{
  "@odata.context": "/redfish/v1/$metadata#ChassisCollection.ChassisCollection",
  "@odata.id": "/redfish/v1/Chassis/",
  "@odata.type": "#ChassisCollection.ChassisCollection",
  "Description": "Collection of Chassis",
  "Members": [
    {
      "@odata.id": "/redfish/v1/Chassis/System.Embedded.1"
    },
    {
      "@odata.id": "/redfish/v1/Chassis/Enclosure.Internal.0-1:RAID.Integrated.1-1"
    }
  ],
  "Members@odata.count": 2,
  "Name": "Chassis Collection"
}

搞定,如果还想需要更多的功能,就去看手册吧。


Viewing all articles
Browse latest Browse all 290

Trending Articles