Add getzfsarccache.sh
This commit is contained in:
46
getzfsarccache.sh
Normal file
46
getzfsarccache.sh
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
intv="$1"
|
||||||
|
|
||||||
|
if [ -z $intv ]
|
||||||
|
then
|
||||||
|
intv=5
|
||||||
|
fi
|
||||||
|
|
||||||
|
prevhits=0
|
||||||
|
prevmisses=0
|
||||||
|
|
||||||
|
i=0
|
||||||
|
|
||||||
|
while true
|
||||||
|
do
|
||||||
|
|
||||||
|
stats=`cat /proc/spl/kstat/zfs/arcstats`
|
||||||
|
hit=`echo "$stats" | grep -w hits | awk '{ print $3}'`
|
||||||
|
miss=`echo "$stats" | grep -w misses | awk '{ print $3}'`
|
||||||
|
|
||||||
|
|
||||||
|
hitrate=$(((hit-prevhits)/intv))
|
||||||
|
missrate=$(((miss-prevmisses)/intv))
|
||||||
|
|
||||||
|
prevhits=$hit
|
||||||
|
prevmisses=$miss
|
||||||
|
|
||||||
|
req=$((hitrate+missrate))
|
||||||
|
|
||||||
|
if [ "$hitrate" != 0 ] && [ "$req" != 0 ]
|
||||||
|
then
|
||||||
|
hitper=`echo "scale=2; (($hitrate / $req) * 100)" | bc`
|
||||||
|
else
|
||||||
|
hitper=0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$i" -gt 0 ]
|
||||||
|
then
|
||||||
|
echo "IOPs: $req | ARC cache hit ratio: $hitper % | Hitrate: $hitrate / Missrate: $missrate"
|
||||||
|
else
|
||||||
|
echo "Loading"
|
||||||
|
fi
|
||||||
|
|
||||||
|
((i++))
|
||||||
|
sleep $intv
|
||||||
|
done
|
||||||
Reference in New Issue
Block a user