redfish使用RESTFUL API 对服务器进行管理

Turn on a system
Server power is controlled by using a POST operation to the ComputerSystem.Reset URI to request the
desired action.
import requests
import json
url = 'https://<iDRAC
IP>/redfish/v1/Systems/System.Embedded.1/Actions/ComputerSystem.Reset'
payload = {'ResetType': 'On'}
headers = {'content-type': 'application/json'}
response = requests.post(url, data=json.dumps(payload), headers=headers,
verify=False, auth=('root','calvin'))
3.3.6 Turn off a system
import requests
import json
url = 'https://<iDRAC
IP>/redfish/v1/Systems/System.Embedded.1/Actions/ComputerSystem.Reset'
payload = {'ResetType': 'ForceOff'}
headers = {'content-type': 'application/json'}
response = requests.post(url, data=json.dumps(payload), headers=headers,
verify=False, auth=('root','calvin'))

官方文件地址

posted @ 2023-12-05 14:47  萱乐庆foreverlove  阅读(212)  评论(0)    收藏  举报