github.com/rohankumardubey/proxyfs@v0.0.0-20210108201508-653efa9ab00e/bin/space.sh (about) 1 #!/bin/bash 2 # 3 # Outputs: 4 # VmSize (kB) sum for all smbd and proxyfsd processes on this node 5 # Disk space used (in 1K-blocks) by all Swift devices on this node 6 7 vmsize=$(pidof proxyfsd smbd | xargs -n 1 | awk '{print "/proc/"$1"/status"}' | xargs -n 1 grep VmSize | awk '{print $2}' | awk '{sum +=1 $1} END {print sum}') 8 9 vdevlist=$(mktemp) 10 11 find /etc/swift -name 20_settings.conf | grep account-server | xargs grep devices | awk '{print $3}' >> $vdevlist 12 find /etc/swift -name 20_settings.conf | grep container-server | xargs grep devices | awk '{print $3}' >> $vdevlist 13 find /etc/swift -name 20_settings.conf | grep object-server | xargs grep devices | awk '{print $3}' >> $vdevlist 14 15 pdevspace=$(mktemp) 16 17 (cat $vdevlist | sort | uniq | xargs df | sort | uniq | grep -v Filesystem | awk '{print $1}' | sort | uniq | xargs df | awk 'NR > 1 {print $3}') > $pdevspace 18 19 rm $vdevlist 20 21 diskspace=$(cat $pdevspace | awk '{sum += $1} END {print sum}') 22 23 rm $pdevspace 24 25 echo "smbd/proxyfsd-VmSize(KB) $vmsize Swift-ACO-space(KB) $diskspace"