White Papers

20 Implementation of the DMTF Redfish API on Dell EMC PowerEdge Servers
3.3.5 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'))
3.3.7 View system power usage
Use this script to view current, average, minimum, and maximum system power consumption.
import requests
import json
system = requests.get('https://<iDRAC
IP>/redfish/v1/Chassis/System.Embedded.1/Power/PowerControl',verify=False,
auth=('root','calvin'))
systemData = system.json()
print "Consumed power: {}".format(systemData[u'PowerConsumedWatts'])
print "Average reading:
{}".format(systemData[u'PowerMetrics'][u'AverageConsumedWatts'])
print "Max reading:
{}".format(systemData[u'PowerMetrics'][u'MaxConsumedWatts'])