获取磁盘完整信息 >>> psutil.disk_partitions() [sdiskpart(device='/dev/xvda1', mountpoint='/', fstype='ext4', opts='rw,relatime,nobarrier,data=ordered'), sdiskpart(device='/dev/xvdb1', mountpoint='/Backup', fstype='ext4', opts='rw,relatime,data=ordered'), sdiskpart(device='/dev/xvdc1', mountpoint='/Volume', fstype='ext4', opts='rw,relatime,data=ordered')] 分区使用情况 >>> psutil.disk_usage('/') sdiskusage(total=21002579968, used=17712050176, free=2200064000, percent=84.3) >>> psutil.disk_usage('/dev/xvda1') sdiskusage(total=4092887040, used=0, free=4092887040, percent=0.0) 系统IO信息, 这个有用,比如mongo server读写情况可以从这里看出硬盘的总的IO个数 >>> psutil.disk_io_counters() sdiskio(read_count=66199319, write_count=26786580, read_bytes=2762422266880, write_bytes=829198069760, read_time=432435439, write_time=1245140957) 系统某一分区的读写情况 >>> psutil.disk_io_counters(perdisk=True) {'xvdb1': sdiskio(read_count=8541383, write_count=4234422, read_bytes=369368880128, write_bytes=188905959424, read_time=61153482, write_time=712140206), 'xvda1': sdiskio(read_count=377984, write_count=2748355, read_bytes=4093592576, write_bytes=117483319296, read_time=4094666, write_time=458812306), 'xvdc1': sdiskio(read_count=57336794, write_count=19803933, read_bytes=2389246342144, write_bytes=522809917440, read_time=367414619, write_time=74215286)}
|