获取磁盘IOPS数值[shell]
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了获取磁盘IOPS数值[shell]相关的知识,希望对你有一定的参考价值。
获取磁盘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]的主要内容,如果未能解决你的问题,请参考以下文章