脚本如下:

#!/usr/bin/env python
#coding:utf-
import win32com.client
import time def disk_status():
try:
while :
strComputer = "."
objWMIService = win32com.client.Dispatch("WbemScripting.SWbemLocator")
objSWbemServices = objWMIService.ConnectServer(strComputer,"root\cimv2")
colItems = objSWbemServices.ExecQuery("SELECT * FROM Win32_PerfFormattedData_PerfDisk_LogicalDisk")
print "time:" + time.strftime("%Y-%m-%d %H:%M:%S")
print "Device:" +'\t' + "tps" +'\t' + "kB_read/s" +'\t' + "kB_wrtn/s" +'\t' + "kB_read" +'\t' + "kB_wrtn" +'\t' +"Disk_free"
for objItem in colItems:
if objItem.Name != '_Total':
print objItem.Name +'\t' + str(objItem.DiskTransfersPersec) +'\t' + "%0.1f" % (float(objItem.DiskReadBytesPersec)/) +'\t' + '\t' + "%0.1f" % (float(objItem.DiskWriteBytesPersec)/) +'\t' + '\t' + "%0.1f" % (float(objItem.DiskReadsPersec)/) +'\t' + "%0.1f" % (float(objItem.DiskWritesPersec)/) +'\t' + "%0.0f%%" % objItem.PercentFreeSpace #Device: 显示磁盘名称
#tps: 表示每秒钟输出到物理磁盘的传输次数。一次传输就是一个对物理磁盘的 I/O 请求。多个逻辑请求可被并为对磁盘的一个单一 I/O 请求。传输具有中等的大小。
#kB_read/s: 每秒从磁盘读取的数据量,单位为KB。
#kB_wrtn/s: 每秒从写入磁盘的数据量,单位为KB。
#Kb_read: 读取的 KB 总数。
#Kb_wrtn: 写入的 KB 总数。
#DiskTransfersPerSec:每秒磁盘传输次数。
#DiskReadBytesPerSec:每秒从磁盘读取得数据量,单位为Byte。
#DiskWriteBytesPerSec:每秒从磁盘写取得数据量,单位为Byte。
#PercentFreeSpace:可用磁盘百分比
print ''
time.sleep()
except (EOFError,KeyboardInterrupt):
pass
if __name__ == '__main__':
disk_status()

执行结果:

time:-- ::
Device: tps kB_read/s kB_wrtn/s kB_read kB_wrtn Disk_free
C: 437.6 700.2 0.1 0.1 %
D: 0.0 0.0 0.0 0.0 %
E: 0.0 0.0 0.0 0.0 %
F: 0.0 0.0 0.0 0.0 %
G: 0.0 0.0 0.0 0.0 %
H: 0.0 0.0 0.0 0.0 %
HarddiskVolume1 0.0 0.0 0.0 0.0 %
HarddiskVolume14 0.0 0.0 0.0 0.0 %
HarddiskVolume15 0.0 0.0 0.0 0.0 %
HarddiskVolume17 0.0 0.0 0.0 0.0 %
HarddiskVolume19 0.0 0.0 0.0 0.0 %
HarddiskVolume21 0.0 0.0 0.0 0.0 %
HarddiskVolume23 0.0 0.0 0.0 0.0 %
HarddiskVolume5 0.0 0.0 0.0 0.0 %
HarddiskVolume6 0.0 0.0 0.0 0.0 %

参考:http://blog.51cto.com/wangwei007/741083

安装win32com.client:

https://github.com/mhammond/pywin32/releases

.windows模拟linux命令iostat的显示的更多相关文章

  1. windows下模拟linux命令的工具 xshell

    windows下模拟linux命令的工具 xshell

  2. Windows模拟linux终端工具Cmder+Gow

    1. 说明 Cmder:Windows下的终端模拟器. Gow: Windows下模拟Linux命令行工具集合.可以在windows执行linux下的大部分命令,如ls.grep.xargs等. 2. ...

  3. Linux命令之hostname - 显示或设置主机名

    我使用过的Linux命令之hostname - 显示或设置主机名 本文链接:http://codingstandards.iteye.com/blog/804648   (转载请注明出处) 用途说明 ...

  4. Linux命令之type - 显示命令的类型

    用途说明 type命令用来显示指定命令的类型.一个命令的类型可以是如下之一 alias 别名 keyword 关键字,Shell保留字 function 函数,Shell函数 builtin 内建命令 ...

  5. 每天一个linux命令:iostat

    1.命令简介 iostat(I/O statistics 输入/输出统计) 命令对系统的磁盘操作活动进行监视.它的特点是汇报磁盘活动统计情况,同时也会汇报出CPU使用情况 2.用法 iostat [ ...

  6. windows模拟linux部分功能

    --------------------------------------------分割线----------------------------------------------- 系统 wi ...

  7. Linux命令之route - 显示和操作IP路由表

    转自:  http://codingstandards.iteye.com/blog/1125312 用途说明 route命令用于显示和操作IP路由表(show / manipulate the IP ...

  8. linux 命令终端提示符显示-bash-4.1#解决方法

    昨天在配置linux,突然发现root登录的CRT的终端提示符显示的是-bash-4.1# 而不是root@主机名 + 路径的显示方式.搞了半天也不知道为什么出现这种情况.今天终于搞定这个问题, 原因 ...

  9. 我使用过的Linux命令之date - 显示、修改系统日期时间

    原文地址:http://www.cnblogs.com/diyunpeng/archive/2011/11/20/2256538.html 用途说明 ate命令可以用来显示和修改系统日期时间,注意不是 ...

随机推荐

  1. bootstrap 轮播craousel 采坑之(修改默认鼠标浮动轮播不停止)

    首先上bootstrap 官网 https://v3.bootcss.com/javascript/#carousel 设置这个参数就可以,后面说如何采坑.见代码 html 部分 <!-- 轮播 ...

  2. js获取当前农历时间

    <template> <div class="gaia-header"> <img alt="gaia_logo" src=&qu ...

  3. CF1272E. Nearest Opposite Parity 题解 广度优先搜索

    题目链接:http://codeforces.com/contest/1272/problem/E 题目大意: 有一个长度为n的数组 \(a\) ,数组坐标从 \(1\) 到 \(n\) . 假设你现 ...

  4. kubelet--help-v1.15.4

    kubelet --help 官方文档   The kubelet is the primary "node agent" that runs on each node. It c ...

  5. schedule of 2016-10-09~2016-10-16(Sunday~Sunday)——1st semester of 2nd Grade

    most important things to do 1.prepare for toefl 2.joint phd preparations 3.ieee trans thesis to writ ...

  6. 【linux学习笔记】

    网上看一个两小时突击linux的教程,就想补充一下linux的知识.想着一天抽出俩小时立马就能学完呢,结果乱七八糟的事情拖了四五天,实际完成某项任务的时间超出预期完成任务的两部不止.好了," ...

  7. wannafly 27 D 巧妙求取约数

    链接:https://www.nowcoder.com/acm/contest/215/D来源:牛客网 题目描述 “我不知道你在说什么,因为我只是个pupil.”--绿魔法师 一个空的可重集合S. n ...

  8. 使用zipwithindex 算子给dataframe增加自增列 row_number函数实现自增,udf函数实现自增

    DataFrame df = ...StructType schema = df.schema().add(DataTypes.createStructField("id", Da ...

  9. android:整理drawable(余下的)(三)

    前言 随着bitmapDrawabe.nithpatchDrawable 与 shapeDrawable 的整理,接下的就更加需要自己的想象设计一些东西. LayerDrawable 意思是层级性的, ...

  10. Activiti邮件任务

    Activiti邮件任务 作者:Jesai 会不会有那么一天,你会妒忌 Activiti有一种任务叫做邮件任务,顾名思义,就是流程办理到邮件任务的时候,系统就会自动的给你发送任务. Activiti所 ...