system_info(query) -- print system specific information like OS, kernel,
	architecture etc.
971786
def system_info(query):
	
	proc = subprocess.Popen(["uname -o"], stdout=subprocess.PIPE, shell=True)
	(out, err) = proc.communicate()
	print "operating system : "+str(out),

	proc = subprocess.Popen(["uname"], stdout=subprocess.PIPE, shell=True)
	(out, err) = proc.communicate()
	print "kernel : "+str(out),

	proc = subprocess.Popen(["uname -r"], stdout=subprocess.PIPE, shell=True)
	(out, err) = proc.communicate()
	print "kernel release : "+str(out),

	proc = subprocess.Popen(["uname -m"], stdout=subprocess.PIPE, shell=True)
	(out, err) = proc.communicate()
	print "architecture : "+str(out),

	proc = subprocess.Popen(["uname -n"], stdout=subprocess.PIPE, shell=True)
	(out, err) = proc.communicate()
	print "network node name : "+str(out),
1190056
def get_memory_info(self) -> str:
        ''''''
        output, _ = self._execute(
            '-s', self.device_sn, 'shell', 'cat', '/proc/meminfo')
        return output
269357
def hardware_info():
    
    try:
        if sys.platform == 'darwin':
            out = _mac_hardware_info()
        elif sys.platform == 'win32':
            out = _win_hardware_info()
        elif sys.platform in ['linux', 'linux2']:
            out = _linux_hardware_info()
        else:
            out = {}
    except:
        return {}
    else:
        return out
762209
def _node_info(conn):
    '''
    
    '''
    raw = conn.getInfo()
    info = {'cpucores': raw[6],
            'cpumhz': raw[3],
            'cpumodel': six.text_type(raw[0]),
            'cpus': raw[2],
            'cputhreads': raw[7],
            'numanodes': raw[4],
            'phymemory': raw[1],
            'sockets': raw[5]}
    return info
445588
def gather_details():
    """"""
    try:
        data = {
            'kernel': platform.uname(),
            'distribution': platform.linux_distribution(),
            'libc': platform.libc_ver(),
            'arch': platform.machine(),
            'python_version': platform.python_version(),
            'os_name': platform.system(),
            'static_hostname': platform.node(),
            'cpu': platform.processor(),
            'fqdn': socket.getfqdn(),
        }
    except AttributeError:
        return {}

    return data
962227
protected function system_memory_info()
    {

        $this->system_memory_kb = array();

        exec("cat /proc/meminfo", $output);
        foreach ($output as $line) {
            $parts = explode(':', $line);

            if (empty($parts[0])) continue;
            // remove the KB sign and reduce it to a key value array
            $this->system_memory_kb[trim($parts[0])] = (int)(!empty($parts[1]) ? trim(str_replace('kB', '', $parts[1])) : null);
        }

        return true;
    }
1258695
def get_facts(self):
        """"""
        commands = []
        commands.append('show version')
        commands.append('show hostname')
        commands.append('show interfaces')

        result = self.device.run_commands(commands)

        version = result[0]
        hostname = result[1]
        interfaces_dict = result[2]['interfaces']

        uptime = time.time() - version['bootupTimestamp']

        interfaces = [i for i in interfaces_dict.keys() if '.' not in i]
        interfaces = string_parsers.sorted_nicely(interfaces)

        return {
            'hostname': hostname['hostname'],
            'fqdn': hostname['fqdn'],
            'vendor': u'Arista',
            'model': version['modelName'],
            'serial_number': version['serialNumber'],
            'os_version': version['internalVersion'],
            'uptime': int(uptime),
            'interface_list': interfaces,
        }
855038
def get_os_dist_info():
    

    distribution = platform.dist()
    dist_name = distribution[0].lower()
    dist_version_str = distribution[1]
    if dist_name and dist_version_str:
        return dist_name, dist_version_str
    else:
        return None, None
612521
def info():
    """"""
    print("convenience function for listing prms")
    print(type(prms))
    print(prms.__name__)
    print(f"prm file: {_get_prm_file()}")

    for key in prms.__dict__:
        if isinstance(prms.__dict__[key], box.Box):
            print()
            print(80 * "=")
            print(f"prms.{key}:")
            print(80 * "-")
            for subkey in prms.__dict__[key]:
                print(
                    f"prms.{key}.{subkey} = ",
                    f"{prms.__dict__[key][subkey]}"
                )
            print(80 * "=")
384411
def print_operating_systems(self, operating_systems):
        
        for _os in operating_systems:
            print('{}: {}'.format(_os.name, _os.slug))
1045981
def print_diskinfo(diskinfo, widelayout, incolor):
    '''  '''
    sep = ' '
    if opts.relative:
        import math
        base = max([ disk.ocap for disk in diskinfo ])

    for disk in diskinfo:
        if disk.ismntd:     ico = _diskico
        else:               ico = _unmnico
        if disk.isrem:      ico = _remvico
        if disk.isopt:      ico = _discico
        if disk.isnet:      ico = _netwico
        if disk.isram:      ico = _ramico
        if disk.isimg:      ico = _imgico
        if disk.mntp == '/boot/efi':
                            ico = _gearico

        if opts.relative and disk.ocap and disk.ocap != base:
            # increase log size reduction by raising to 4th power:
            gwidth = int((math.log(disk.ocap, base)**4) * opts.width)
        else:
            gwidth = opts.width

        # check color settings, ffg: free foreground, ufg: used forground
        if disk.rw:
            ffg = ufg = None        # auto colors
        else:
            # dim or dark grey
            ffg = ufg = (ansi.dim8 if opts.hicolor else ansi.dim4)

        cap = disk.cap
        if cap and disk.rw:
            lblcolor = ansi.get_label_tmpl(disk.pcnt, opts.width, opts.hicolor)
        else:
            lblcolor = None

        # print stats
        data = (
            (_usedico, disk.pcnt,     ufg,  None,  pform.boldbar),  # Used
            (_freeico, 100-disk.pcnt, ffg,  None,  False),          # free
        )
        mntp = fmtstr(disk.mntp, align='<', trunc='left',
                      width=(opts.colwidth * 2) + 2)
        mntp = mntp.rstrip()  # prevent wrap
        if disk.label is None:
            label = fmtstr(_emptico, dim_templ, align='<')
        else:
            label = fmtstr(disk.label, align='<')

        if widelayout:
            out(
                fmtstr(ico + sep + disk.dev, align='<') + label
            )
            if cap:
                out(fmtval(cap))
                if disk.rw:
                    out(
                        fmtval(disk.used, lblcolor) +
                        fmtval(disk.free, lblcolor)
                    )
                else:
                    out(
                        fmtstr() +
                        fmtstr(_emptico, dim_templ)
                    )
            else:
                out(fmtstr(_emptico, dim_templ))

            if cap:
                if disk.rw:  # factoring this caused colored brackets
                    ansi.rainbar(data, gwidth, incolor,
                                 hicolor=opts.hicolor,
                                 cbrackets=_brckico)
                else:
                    ansi.bargraph(data, gwidth, incolor, cbrackets=_brckico)

                if opts.relative and opts.width != gwidth:
                    out(sep * (opts.width - gwidth))
                out(sep + mntp)
            print()
        else:
            out(
                fmtstr(ico + sep + disk.dev, align="<") + label
            )
            if cap:
                out(
                    fmtval(cap) +
                    fmtval(disk.used, lblcolor) +
                    fmtval(disk.free, lblcolor)
                )
            else:
                out(fmtstr(_emptico, dim_templ) + fmtstr() + fmtstr())
            print(sep, mntp)

            if cap:
                out(fmtstr())
                if disk.rw:
                    ansi.rainbar(data, gwidth, incolor, hicolor=opts.hicolor,
                                 cbrackets=_brckico)
                else:
                    ansi.bargraph(data, gwidth, incolor, cbrackets=_brckico)
            print()
            print()
    print()
203330
def system_information():
    '''
    
    '''
    def system_version():
        '''
        Return host system version.
        '''
        lin_ver = linux_distribution()
        mac_ver = platform.mac_ver()
        win_ver = platform.win32_ver()

        if lin_ver[0]:
            return ' '.join(lin_ver)
        elif mac_ver[0]:
            if isinstance(mac_ver[1], (tuple, list)) and ''.join(mac_ver[1]):
                return ' '.join([mac_ver[0], '.'.join(mac_ver[1]), mac_ver[2]])
            else:
                return ' '.join([mac_ver[0], mac_ver[2]])
        elif win_ver[0]:
            return ' '.join(win_ver)
        else:
            return ''

    if platform.win32_ver()[0]:
        # Get the version and release info based on the Windows Operating
        # System Product Name. As long as Microsoft maintains a similar format
        # this should be future proof
        import win32api  # pylint: disable=3rd-party-module-not-gated
        import win32con  # pylint: disable=3rd-party-module-not-gated

        # Get the product name from the registry
        hkey = win32con.HKEY_LOCAL_MACHINE
        key = 'SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion'
        value_name = 'ProductName'
        reg_handle = win32api.RegOpenKey(hkey, key)

        # Returns a tuple of (product_name, value_type)
        product_name, _ = win32api.RegQueryValueEx(reg_handle, value_name)

        version = 'Unknown'
        release = ''
        if 'Server' in product_name:
            for item in product_name.split(' '):
                # If it's all digits, then it's version
                if re.match(r'\d+', item):
                    version = item
                # If it starts with R and then numbers, it's the release
                # ie: R2
                if re.match(r'^R\d+$', item):
                    release = item
            release = '{0}Server{1}'.format(version, release)
        else:
            for item in product_name.split(' '):
                # If it's a number, decimal number, Thin or Vista, then it's the
                # version
                if re.match(r'^(\d+(\.\d+)?)|Thin|Vista$', item):
                    version = item
            release = version

        _, ver, sp, extra = platform.win32_ver()
        version = ' '.join([release, ver, sp, extra])
    else:
        version = system_version()
        release = platform.release()

    system = [
        ('system', platform.system()),
        ('dist', ' '.join(linux_distribution(full_distribution_name=False))),
        ('release', release),
        ('machine', platform.machine()),
        ('version', version),
        ('locale', __salt_system_encoding__),
    ]

    for name, attr in system:
        yield name, attr
        continue
473918
def OPERATING_SYSTEM(stats, info):
    
    info.append(('architecture', platform.machine().lower()))
    info.append(('distribution',
                 "%s;%s" % (platform.linux_distribution()[0:2])))
    info.append(('system',
                 "%s;%s" % (platform.system(), platform.release())))
1239705
function computer_info($computer_name,$fields=NULL){
        if ($computer_name==NULL){ return (false); }
        if (!$this->_bind){ return (false); }

        $filter="(&(objectClass=computer)(cn=".$computer_name."))";
        if ($fields==NULL){ $fields=array($this->_group_attribute,"cn","displayname","dnshostname","distinguishedname","objectcategory","operatingsystem","operatingsystemservicepack","operatingsystemversion"); }
        $sr=ldap_search($this->_conn,$this->_base_dn,$filter,$fields);
        $entries = $this->ldap_get_entries_raw($sr);
        
        return ($entries);
    }
848276
def device_info(self):
        
        # get hostname, model, and version from 'show version'
        resp = self._session.get_software_information(format='xml')

        hostname = resp.xpath('//software-information/host-name')[0].text
        model = resp.xpath('//software-information/product-model')[0].text

        version = 'Unknown'
        if resp.xpath('//junos-version'):
            """ case:
                <junos-version>15.1</junos-version>
            """
            try:
                version = resp.xpath('//junos-version')[0].text
            except IndexError:
                pass
        elif resp.xpath("//package-information[name = 'junos-version']"):
            """ case:
                <package-information>
                    <name>junos-version</name>
                    <comment>Junos: 14.2R4</comment>
                </package-information>
           """
            try:
                version = (resp.xpath(
                    "//package-information[name = 'junos-version']/comment"
                    )[0].text).split()[1]
            except IndexError:
                pass
        else:
            """ case:
                <package-information>
                    <name>junos</name>
                    <comment>JUNOS Base OS boot [12.3R5]</comment>
                </package-information>
            """
            try:
                version = ((resp.xpath(
                    '//software-information/package-information/comment'
                    )[0].text.split('[')[1].split(']')[0]))
            except IndexError:
                pass

        # try looking for 'junos-version' for >= 14.2
#        for element in resp.xpath('//software-information'):
#            version = element.findtext('junos-version')

#        if not version:
#            try:
#                version = ((resp.xpath(
#                    '//software-information/package-information/comment')
#                    [0].text.split('[')[1].split(']')[0]))
#            except IndexError:
#                version = 'Unknown'

        # get uptime from 'show system uptime'
        resp = self._session.get_system_uptime_information(format='xml')
        try:
            current_time = resp.xpath('//current-time/date-time')[0].text
        except IndexError:
            current_time = 'Unknown'
        try:
            uptime = resp.xpath('//uptime-information/up-time')[0].text
        except IndexError:
            uptime = 'Unknown'
        # get serial number from 'show chassis hardware'
        show_hardware = self._session.get_chassis_inventory(format='xml')
        # If we're hitting an EX, grab each Routing Engine Serial number
        # to get all RE SNs in a VC
        try:
            chassis_module = show_hardware.xpath(
                '//chassis-inventory/chassis/chassis-module/description'
                )[0].text
        except IndexError:
            chassis_module = 'Unknown'

        if ('EX' or 'ex' or 'Ex') in chassis_module:
            serial_num = ''
            for eng in show_hardware.xpath(
                    '//chassis-inventory/chassis/chassis-module'):
                if 'Routing Engine' in eng.xpath('name')[0].text:
                    serial_num += (eng.xpath('name')[0].text + ' Serial #: ' +
                                   eng.xpath('serial-number')[0].text)
        else:  # Any other device type, just grab chassis SN
            try:
                serial_num = ('Chassis Serial Number: ' + show_hardware.xpath(
                    '//chassis-inventory/chassis/serial-number')[0].text)
            except IndexError:
                serial_num = 'Chassis Serial Number: ' \
                    + 'Unknown (virtual machine?)'
        return ('Hostname: %s\nModel: %s\nJunos Version: %s\n%s\nCurrent Time:'
                ' %s\nUptime: %s\n' %
                (hostname, model, version, serial_num, current_time, uptime))
971658
def display_info(self):
        """"""

        if self.moc is None:
            print('No MOC information present')
            return

        if self.moc.name is not None:
            print('Name:', self.moc.name)
        if self.moc.id is not None:
            print('Identifier:', self.moc.id)
        print('Order:', self.moc.order)
        print('Cells:', self.moc.cells)
        print('Area:', self.moc.area_sq_deg, 'square degrees')
513100
def prt_detail(self):
        
        screen = [
            "Detail info of %s: " % self.abspath,
            "total size = %s" % string_SizeInBytes(self.size_total),
            "number of sub folders = %s" % self.num_folder_total,
            "number of total files = %s" % self.num_file_total,
            "lvl 1 file size = %s" % string_SizeInBytes(self.size_current),
            "lvl 1 folder number = %s" % self.num_folder_current,
            "lvl 1 file number = %s" % self.num_file_current,
        ]
        print("\n".join(screen))