#!/bin/bash
if [ $# != 1 ]; then
echo "USAGE: $0 pool_name"
exit 1;
fi
sum=0
x=0.001文章来源:https://www.toymoban.com/news/detail-851815.html
for i in `rbd ls $1`
do
s=`rbd info $1/$i | grep size |cut -d' ' -f2`
u=`rbd info $1/$i | grep size |cut -d' ' -f3`
if [ "$u" == "KiB" ]; then
s=`echo $(echo "$s*$x*$x"|bc)`
sum=`echo $(echo "$sum+$s"|bc)`
elif [ "$u" == "MiB" ]; then
s=`echo $(echo "$s*$x"|bc)`
sum=`echo $(echo "$sum+$s"|bc)`
elif [ "$u" == "GiB" ]; then
sum=`echo $(echo "$sum+$s"|bc)`
elif [ "$u" == "TiB" ]; then
s=`echo $(echo "$s*1000"|bc)`
sum=`echo $(echo "$sum+$s"|bc)`
fi
echo $i $s $u " "$sum
done
文章来源地址https://www.toymoban.com/news/detail-851815.html
到了这里,关于统计ceph 指定存储池里面的rbd/已分配rbd 总容量小脚本的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!