diff --git a/check_full_pvs.sh b/check_full_pvs.sh index 69ec026..7cf0fe8 100755 --- a/check_full_pvs.sh +++ b/check_full_pvs.sh @@ -124,7 +124,7 @@ for ns in $ALLNS; do for pv in $usedstr; do usedperc=$(echo "$pv" | awk '{print $10}') pvcname=$(echo "$pv" | awk '{print $2}') - size=$(echo "$pv" | awk '{print $7}' | numfmt --from=iec-i --to=iec-i --to-unit=Gi --round=up) + size=$(kubectl get pvc $pvcname -n $ns -o=jsonpath='{.status.capacity.storage}' | numfmt --from=iec-i --to=iec-i --to-unit=Gi --round=up) if (( $(bc <<< "($usedperc > $FULLTHRESHOLD)") )); then echo "Volume $pvcname is almost full: ${usedperc}%!" if [ $FIX -ne 0 ]; then