Get Computer details - HewlettPackard/python-ilorest-library GitHub Wiki
If not created already, create an instance of Rest or Redfish Object using the RestObject or RedfishObject class respectively. The class constructor takes iLO hostname/ ip address, iLO login username and password as arguments. The class also initializes a login session, gets systems resources and message registries.
Rest Object creation:
:
Redfish Object creation:
:
The method ex16_computer_details takes an instance of rest object ( or redfish object if using Redfish API ) as argument.
:
Find and get the system resource for computer system.
:
Send HTTP GET request to the system URI(s).
:
For each system print manufacturer, model and serial number from the response body..
:
Next print virtual serial number, virtual UUID, asset tag if any.
if "VirtualSerialNumber" in response.dict:
sys.stdout.write("\tVirtual Serial Number: " +
str(response.dict["VirtualSerialNumber"]) + "\n")
else:
sys.stderr.write("\tVirtual Serial Number information not " \
"available on system resource\n")
sys.stdout.write("\tUUID: " + str(response.dict["UUID"]) + "\n")
if "VirtualUUID" in response.dict["Oem"]["Hp"]:
sys.stdout.write("\tVirtualUUID: " + \
str(response.dict["Oem"]["Hp"]["VirtualUUID"]) + "\n")
else:
sys.stderr.write("\tVirtualUUID not available system " \
"resource\n")
if "AssetTag" in response.dict:
sys.stdout.write("\tAsset Tag: " + response.dict["AssetTag"] \
+ "\n")
else:
sys.stderr.write("\tNo Asset Tag information on system" \
"resource\n")
:
Print BIOS version, memory and CPU information.
sys.stdout.write("\tBIOS Version: " + \
response.dict["Bios"]["Current"]["VersionString"] + "\n")
sys.stdout.write("\tMemory: " +
str(response.dict["Memory"]["TotalSystemMemoryGB"]) +" GB\n")
sys.stdout.write("\tProcessors: " + \
str(response.dict["Processors"]["Count"]) + " x " + \
str(response.dict["Processors"]["ProcessorFamily"])+ "\n")
:
Print health information.
:
If host correlation available, print details.
if "HostCorrelation" in response.dict:
if "HostFQDN" in response.dict["HostCorrelation"]:
sys.stdout.write("\tHost FQDN: " + \
response.dict["HostCorrelation"]["HostFQDN"] + "\n")
if "HostMACAddress" in response.dict["HostCorrelation"]:
for mac in response.dict["HostCorrelation"]["HostMACAddress"]:
sys.stdout.write("\tHost MAC Address: " + str(mac) + "\n")
if "HostName" in response.dict["HostCorrelation"]:
sys.stdout.write("\tHost Name: " + \
response.dict["HostCorrelation"]["HostName"] + "\n")
if "IPAddress" in response.dict["HostCorrelation"]:
for ip_address in response.dict["HostCorrelation"]\
["IPAddress"]:
if ip_address:
sys.stdout.write("\tHost IP Address: " + \
str(ip_address) + "\n")
: