def dynamic(): dynamic_info = OrderedDict({'Uptime':str(pylinux.uptime())+' hours', #'Number of Processes':len(pylinux.processes()), #'Open Files':pylinux.lsof(), #'Free Memory':str(float(pylinux.freemem().split()[0])/1024.0) + ' MB', 'Network Stats':pylinux.netdevs(), 'Load':pylinux.avg_load() }) return render_template('dynamic.html',dynamic_info=dynamic_info)
def dynamic(): dynamic_info = OrderedDict({ 'Uptime': str(pylinux.uptime()) + ' hours', #'Number of Processes':len(pylinux.processes()), #'Open Files':pylinux.lsof(), #'Free Memory':str(float(pylinux.freemem().split()[0])/1024.0) + ' MB', 'Network Stats': pylinux.netdevs(), 'Load': pylinux.avg_load() }) return render_template('dynamic.html', dynamic_info=dynamic_info)
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()) print 'Average Load:: ' + pylinux.avg_load() net_devs = pylinux.netdevs() print 'Network Devices:: ' for dev in net_devs.keys(): print dev + ': ' + 'Recieved (MB): ' + str(net_devs[dev].rx) + \ ' Transmitted (MB): ' + str(net_devs[dev].tx) #mounted file systems print 'Physical File Systems Mounted::' print pylinux.mounts() print 'All File Systems Mounted::' print pylinux.mounts(nodev=False)