iport = auth['iport'] iuser = auth['iuser'] ipassword = auth['ipassword'] idbname = auth['idbname'] except: print("Problem loading nextract_config.json") pass if len(hostname) == 0: print("Usage: %s HMC-hostname HMC-username HMC-password" % (sys.argv[0])) sys.exit(1) #print("HMC hostanme=%s User=%s Password=%s" %( hostname, user, password)) print("-> Logging on to %s as user %s" % (hostname, user)) hmc = hmc_pcm.HMC(hostname, user, password) # Log on to the HMC #hmc.set_debug(True) #hmc.set_debug(True) serverlist = hmc.get_server_details_pcm( ) # Get list of attached Managed Servers dictionary for count, server in enumerate(serverlist, start=1): # Loop through the Servers if server['capable'] == 'false': print("-->Server %d %s not capable of supplying energy stats" % (count, server['name'])) continue if server['energy'] == 'false': print("-->Server %d %s is energy stats capable but not enabled" % (count, server['name'])) continue
#!/usr/bin/python3 # Version 5 import hmc_pcm as hmc import time import sys if len(sys.argv) != 4: print("Usage: %s HMC-hostname HMC-username HMC-password" % (sys.argv[0])) sys.exit(1) hostname = sys.argv[1] user = sys.argv[2] password = sys.argv[3] print("HMC hostanme=%s User=%s Password=%s" % (hostname, user, password)) print("-> Logging on to %s as user %s" % (hostname, user)) hmc = hmc.HMC(hostname, user, password) #hmc.set_debug(True) serverlist = hmc.get_server_details_pcm( ) # returns a list of dictionaries one per Server flags_need_setting = 0 for count, server in enumerate(serverlist): if server['capable'] == 'false': print("-->Server %d %-20s not capable of supplying Energy stats" % (count, server['name'])) continue if server['energy'] == 'false': print( "-->Server %d %-20s capable of collecting Enegry stats and not enabled" % (count, server['name']))
import sys if len(sys.argv) != 4: # four including the program name entry [0] print("Usage: %s HMC-hostname HMC-username HMC-password" % (sys.argv[0])) sys.exit(1) hostname = sys.argv[1] user = sys.argv[2] password = sys.argv[3] print("HMC hostanme=%s User=%s Password=%s" % (hostname, user, password)) output_html = True output_csv = False output_csvold = False print("-> Logging on to %s as user %s" % (hostname, user)) hmc = hmc_pcm.HMC(hostname, user, password) print("-> Get Stripped Preferences") # returns XML text prefstripped = hmc.get_stripped_preferences_ssp() print("-> Parse Preferences") ssplist = hmc.parse_prefs_ssp( prefstripped) # returns a list of dictionaries one per SSP all_true = True enabled = [] for ssp in ssplist: if ssp['agg'] == 'false' or ssp['mon'] == 'false': good = "BAD " all_true = False else: good = "GOOD"