From 48f2f1c410d94c3d2660aa428dcfd6240b731f3b Mon Sep 17 00:00:00 2001 From: Jaime Melis <jmelis@opennebula.org> Date: Thu, 4 Feb 2016 18:36:18 +0100 Subject: [PATCH] Feature #4217: Fix the way FREE_MB is calculated --- src/market_mad/remotes/http/monitor | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/market_mad/remotes/http/monitor b/src/market_mad/remotes/http/monitor index b4e8883bc2..0a9ef8bdaf 100755 --- a/src/market_mad/remotes/http/monitor +++ b/src/market_mad/remotes/http/monitor @@ -58,7 +58,7 @@ PUBLIC_DIR="${XPATH_ELEMENTS[i++]}" MONITOR_SCRIPT=$(cat <<EOF USED_MB=\$(df -B1M -P ${PUBLIC_DIR} 2>/dev/null | tail -n 1 | awk '{print \$3}') TOTAL_MB=\$(df -B1M -P ${PUBLIC_DIR} 2>/dev/null | tail -n 1 | awk '{print \$2}') -FREE_MB=\$(df -B1M -P ${PUBLIC_DIR} 2>/dev/null | tail -n 1 | awk '{print \$4}') +FREE_MB=\$(expr \$TOTAL_MB - \$USED_MB) if [ -z "\$USED_MB" -o -z "\$TOTAL_MB" -o -z "\$FREE_MB" ]; then msg="Empty value found"