We have all data we need
This commit is contained in:
parent
380d911596
commit
9707368e3d
22
main.py
22
main.py
|
@ -78,13 +78,14 @@ logging.info("There are " + str(baysInUseCount+1) + "servers presenet.") # Furth
|
||||||
|
|
||||||
|
|
||||||
## Get blade data ##
|
## Get blade data ##
|
||||||
for b in range(1, baysInUseCount+1):
|
for n in range(baysInUseCount):
|
||||||
logging.info("Accessing server " + str(b))
|
bay = servers[n][0] # We want the bay, not how many times we have looped over.
|
||||||
logging.debug( ssh_runcmd('connect server ' + str(b)) ) # Use the enc as a jump host.
|
logging.info("Accessing server " + str(bay))
|
||||||
|
logging.debug( ssh_runcmd('connect server ' + str(bay)) ) # Use the enc as a jump host.
|
||||||
powerInfoTmp = ssh_runcmd('show system1/oemhp_power1') # Get the data
|
powerInfoTmp = ssh_runcmd('show system1/oemhp_power1') # Get the data
|
||||||
|
|
||||||
presentPower = [i for i in powerInfoTmp if i.startswith(' oemhp_PresentPower=')][0][23:-7] # Get the line with PresentPower, then remove first 23, and last 7 chars to end up with the Watts DC the blade is directly using.
|
presentPower = [i for i in powerInfoTmp if i.startswith(' oemhp_PresentPower=')][0][23:-7] # Get the line with PresentPower, then remove first 23, and last 7 chars to end up with the Watts DC the blade is directly using.
|
||||||
servers[b-1].append(int(presentPower)) # And push it to our miniDB of the servers list.
|
servers[n].append(int(presentPower)) # And push it to our miniDB of the servers list.
|
||||||
logging.info("UsageRawDC: " + presentPower)
|
logging.info("UsageRawDC: " + presentPower)
|
||||||
|
|
||||||
logging.debug(ssh_runcmd('exit')) # Exit the blade's iLO, return to the enc's iLO SSH interface.
|
logging.debug(ssh_runcmd('exit')) # Exit the blade's iLO, return to the enc's iLO SSH interface.
|
||||||
|
@ -96,9 +97,18 @@ for b in range(1, baysInUseCount+1):
|
||||||
|
|
||||||
|
|
||||||
## Get enc's _AC_ usage. ##
|
## Get enc's _AC_ usage. ##
|
||||||
encPowerUsageAC = int( [i for i in ssh_runcmd('show power') if i.startswith('Present Power:')][0] )# [23:-7]
|
encPowerUsageAC = int(str.strip( [i for i in ssh_runcmd('show power') if i.startswith('Present Power:')][0][14:-9] ))
|
||||||
logging.info("Server total usage AC: " + str(encPowerUsageAC))
|
logging.info("Server total usage AC: " + str(encPowerUsageAC))
|
||||||
|
|
||||||
# End sesion with enc.
|
## End sesion with enc. ##
|
||||||
channel.send('exit' + '\n') # Using lower level cmd since we're not going to get a prompt back here.
|
channel.send('exit' + '\n') # Using lower level cmd since we're not going to get a prompt back here.
|
||||||
ssh.close()
|
ssh.close()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## Calculating blade usage by percentage. ##
|
||||||
|
# Keep in mind the querying of the data took a while, a minute or so.
|
||||||
|
|
||||||
|
breakpoint()
|
||||||
|
print()
|
||||||
|
|
Loading…
Reference in New Issue