diff --git a/src/datastore_mad/remotes/ceph/monitor b/src/datastore_mad/remotes/ceph/monitor index 6ba8e9daad..ecd898181d 100755 --- a/src/datastore_mad/remotes/ceph/monitor +++ b/src/datastore_mad/remotes/ceph/monitor @@ -54,7 +54,7 @@ POOL_NAME="${XPATH_ELEMENTS[1]:-$POOL_NAME}" # ------------ Compute datastore usage ------------- MONITOR_SCRIPT=$(cat </dev/null | cut -f1) +set -e -DF_STR=\$(df -m | grep ${BASE_PATH%/} | sed 's/ \+/:/g') +USED_MB=\$($DU -sLm ${BASE_PATH%/} 2>/dev/null | $CUT -f1) -TOTAL_MB=\$(echo \$DF_STR | cut -d':' -f 2) -FREE_MB=\$(echo \$DF_STR | cut -d':' -f 4) +DF_STR=\$($DF -m | grep ${BASE_PATH%/} | $SED 's/ \+/:/g') + +TOTAL_MB=\$(echo \$DF_STR | $CUT -d':' -f 2) +FREE_MB=\$(echo \$DF_STR | $CUT -d':' -f 4) echo "USED_MB=\$USED_MB" echo "TOTAL_MB=\$TOTAL_MB" diff --git a/src/mad/sh/scripts_common.sh b/src/mad/sh/scripts_common.sh index b41099a59e..e194ae532d 100644 --- a/src/mad/sh/scripts_common.sh +++ b/src/mad/sh/scripts_common.sh @@ -23,6 +23,7 @@ BASH=bash CUT=cut DATE=date DD=dd +DF=df DU=du GREP=grep ISCSIADM=iscsiadm @@ -49,6 +50,8 @@ TAR=tar TGTADM=tgtadm TGTADMIN=tgt-admin TGTSETUPLUN=tgt-setup-lun-one +TR=tr +VGDISPLAY=vgdisplay VMKFSTOOLS=vmkfstools WGET=wget @@ -308,6 +311,8 @@ function mkfs_command { function ssh_exec_and_log { SSH_EXEC_ERR=`$SSH $1 sh -s 2>&1 1>/dev/null </dev/null <