From 9d159be6a623e0fbaf4e0b4d3cc66203217e6a6d Mon Sep 17 00:00:00 2001 From: Fabio Rauber Date: Fri, 22 Apr 2022 14:06:51 -0300 Subject: [PATCH] Fix issue with stale kubelet volume metrics --- check_full_pvs.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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