獲取磁盤IOPS數值[shell]
阿新 • • 發佈:2018-01-31
func sleep awk bin 數值 roc function ops ech 獲取磁盤IOPS數值[shell]
#!/bin/sh DISK="vdc1" function getIops(){ READ1=`cat /proc/diskstats |grep "${DISK} "|awk ‘{print $4}‘` WRIT1=`cat /proc/diskstats |grep "${DISK} "|awk ‘{print $8}‘` sleep 10 READ2=`cat /proc/diskstats |grep "${DISK} "|awk ‘{print $4}‘` WRIT2=`cat /proc/diskstats |grep "${DISK} "|awk ‘{print $8}‘` READIOPS=$(( ($READ2-$READ1)/10 )) WRITIOPS=$(( ($WRIT2-$WRIT1)/10 )) echo DISK: $DISK ,READ IOPS: $READIOPS echo DISK: $DISK ,WRIT IOPS: $WRITIOPS } getIops
獲取磁盤IOPS數值[shell]