获取磁盘IOPS数值[shell]

前端之家收集整理的这篇文章主要介绍了获取磁盘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
原文链接:https://www.f2er.com/bash/388852.html

猜你在找的Bash相关文章