Example #1
0
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 
Example #2
0
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_disk_busy_stats(sample_duration_sec=1):
    return round(disk_stat.disk_busy('sda', sample_duration_sec), 4)
def read_disk_busy_stats(sample_duration_sec=1):
    return round(disk_stat.disk_busy('sda', sample_duration_sec), 4)
Example #5
0
 def test_disk_busy(self):
     value = disk_stat.disk_busy(self.device, self.sample_duration)
     self.assertTrue(0.0 <= value <= 100.0, value)