Ejemplo n.º 1
0
def host_print_details(hosts):
    headers = [
        "Key", "Name", "Version", "IP", "Status", "Mem", "Mem Usage",
        "Mem Fairness", "CPUs", "Cores", "Threads", "CPU Usage",
        "CPU Fairness", "NICs", "VMs", "Uptime"
    ]
    tabs = []
    for host in hosts:
        info = host.info()

        mem = sizeof_fmt(info.mem_size)
        mem_usage = "{0} %".format(
            round(info.mem_usage * 100 / float(info.mem_size), 2))
        cpu_usage = "{0} %".format(
            round(info.mean_core_usage_mhz * 100 / float(info.cpu_mhz), 2))

        vals = [
            host.key, info.name, info.version, info.ip, info.status, mem,
            mem_usage, info.mem_fairness, info.cpu, info.cores, info.threads,
            cpu_usage, info.cpu_fairness, info.nics, info.vms,
            humanize_time(info.uptime)
        ]
        tabs.append(vals)

    print tabulate(tabs, headers)
Ejemplo n.º 2
0
def host_print_details(hosts):
    headers = [ "Key", "Name", "Version", "IP", "Status", "Mem", "Mem Usage", "Mem Fairness",
                "CPUs", "Cores", "Threads", "CPU Usage", "CPU Fairness",
                "NICs", "VMs", "Uptime" ]
    tabs = []
    for host in hosts:
        info = host.info()

        mem = sizeof_fmt(info.mem_size)
        mem_usage = "{0} %".format(round(info.mem_usage * 100 / float(info.mem_size), 2))
        cpu_usage = "{0} %".format(round(info.mean_core_usage_mhz * 100 / float(info.cpu_mhz), 2))

        vals = [ host.key, info.name, info.version, info.ip, info.status, mem, mem_usage, info.mem_fairness,
                 info.cpu, info.cores, info.threads, cpu_usage, info.cpu_fairness,
                 info.nics, info.vms, humanize_time(info.uptime) ]
        tabs.append(vals)

    print tabulate(tabs, headers)
Ejemplo n.º 3
0
    def __init__(self, vm):
        summary = vm.summary
        config = summary.config
        runtime = summary.runtime
        guest = summary.guest
        storage = summary.storage
        stats = summary.quickStats

        self.name = config.name
        self.status = runtime.powerState
        self.pool = vm.resourcePool.name
        self.host = esx_name(str(runtime.host))
        self.folder = vm_guess_folder(vm)
        self.os = config.guestFullName
        self.hostname = guest.hostName
        self.ip = guest.ipAddress
        self.cpu = config.numCpu
        self.mem = config.memorySizeMB
        self.nic = config.numEthernetCards
        self.hd_size = (storage.committed + storage.uncommitted) / 1024 / 1024 / 1024
        self.uptime = humanize_time(stats.uptimeSeconds)
Ejemplo n.º 4
0
    def __init__(self, vm):
        summary = vm.summary
        config = summary.config
        runtime = summary.runtime
        guest = summary.guest
        storage = summary.storage
        stats = summary.quickStats

        self.name = config.name
        self.status = runtime.powerState
        self.pool = vm.resourcePool.name
        self.host = esx_name(str(runtime.host))
        self.folder = vm_guess_folder(vm)
        self.os = config.guestFullName
        self.hostname = guest.hostName
        self.ip = guest.ipAddress
        self.cpu = config.numCpu
        self.mem = config.memorySizeMB
        self.nic = config.numEthernetCards
        self.hd_size = (storage.committed +
                        storage.uncommitted) / 1024 / 1024 / 1024
        self.uptime = humanize_time(stats.uptimeSeconds)