예제 #1
0
파일: app.py 프로젝트: amitsaha/pylinux
def index():

    static_info = OrderedDict({'FQDN':pylinux.hostname(),
                               'Linux Distribution':pylinux.distro_name(),
                               'Release': pylinux.distro_release() + '(' +pylinux.distro_nickname() + ')',
                               'Arch': pylinux.arch(),
                               'Processing Units':pylinux.nprocs(),
                               'Total Memory': str(float(pylinux.totalmem().split()[0])/1024.0) + ' MB',
                               'Kernel':pylinux.kernel()
                   })
    return render_template('index.html',static_info=static_info)
예제 #2
0
def index():

    static_info = OrderedDict({
        'FQDN':
        pylinux.hostname(),
        'Linux Distribution':
        pylinux.distro_name(),
        'Release':
        pylinux.distro_release() + '(' + pylinux.distro_nickname() + ')',
        'Arch':
        pylinux.arch(),
        'Processing Units':
        pylinux.nprocs(),
        'Total Memory':
        str(float(pylinux.totalmem().split()[0]) / 1024.0) + ' MB',
        'Kernel':
        pylinux.kernel()
    })
    return render_template('index.html', static_info=static_info)
예제 #3
0
파일: example.py 프로젝트: obrunet/PyLinux
#!/usr/bin/python

import pylinux.pylinux as pylinux

## Static Information

print 'Distribution:: ', pylinux.distro_name() + ' ' + \
    pylinux.distro_release() + ' ' + \
    pylinux.distro_nickname()

print 'OS Architecture:: ' + pylinux.arch()
print 'Kernel:: ', pylinux.kernel()
print 'Total Memory:: ' + pylinux.totalmem()

# obtain the /proc/cpuinfo information
# as a dictionary
pylinux_cpuinfo = pylinux.cpuinfo()
for i,key in enumerate(pylinux_cpuinfo.keys()):
    print 'Processor: {0} Physical ID: {1}'.format(i,pylinux_cpuinfo[key]['physical id'])

print 'Hostname:: ', pylinux.hostname()
print 'IP Address to connect to external server:: ', pylinux.ipaddr()

## dynamic information

print 'System Uptime:: {0} hours'.format(pylinux.uptime())
print 'Time of Last Boot:: ' + pylinux.last_boot()
print 'Current Users:: ' + pylinux.users()
print 'Free Memory:: ' + pylinux.freemem()
print 'Number of Processes:: ' + str(len(pylinux.processes()))
print 'Number of Open Files:: ' + str(pylinux.lsof())