示例#1
0
    def run(self):
        # Everything is already gathered in the inventory, just add
        # the time
        out = []
        datetime = now()
        sysinfo = SysInfo()
        for fs in sysinfo.file_systems():
            fs['datetime'] = datetime
            out.append(fs)

        return out
示例#2
0
def host_info(hostname_cfg):
    """Gather system information."""
    sinfo = SysInfo()
    _, _, _, _, arch = sinfo.uname()
    hostname = sinfo.hostname(hostname_cfg)

    hostinfo = {
        "hostname": hostname,
        "os": sinfo.os,
        "os_version": sinfo.os_release,
        "cpu_arch": arch
    }
    hostinfo.update(sinfo.cpu_info())
    hostinfo['memory_size'] = sinfo.mem_info()['MemTotal']
    hostinfo['ip_addresses'] = sinfo.ip_addresses()
    hostinfo['filesystems'] = sinfo.file_systems()
    hostinfo['os_flavor'] = sinfo.os_flavor()
    return hostinfo