def main(): # cpu print 'procs running: %d' % cpu_stat.procs_running() cpu_pcts = cpu_stat.cpu_percents(sample_duration=1) print 'cpu utilization: %.2f%%' % (100 - cpu_pcts['idle']) # disk print 'disk busy: %s%%' % disk_stat.disk_busy('sda', sample_duration=1) r, w = disk_stat.disk_reads_writes('sda') print 'disk reads: %s' % r print 'disk writes: %s' % w # memory used, total = mem_stat.mem_stats() print 'mem used: %s' % used print 'mem total: %s' % total # network rx_bits, tx_bits = net_stat.rx_tx_bits('eth0') print 'net bits received: %s' % rx_bits print 'net bits sent: %s' % tx_bits
def read_network_bits_recieved(): return round((net_stat.rx_tx_bits('eth0')[0]) / (8192), 2)
def test_tx_bits(self): _, value = net_stat.rx_tx_bits(self.interface) self.assertTrue(value >= 0, value)