diff --git a/src/datastore_mad/remotes/ceph/monitor b/src/datastore_mad/remotes/ceph/monitor index db5c509437..1f1a4cf51d 100755 --- a/src/datastore_mad/remotes/ceph/monitor +++ b/src/datastore_mad/remotes/ceph/monitor @@ -59,9 +59,9 @@ $SUDO $RADOS df | $AWK '{ space = int(\$3/1024) - if (\$2 == "used") {var = "USED_MB" } - else if (\$2 == "avail") {var = "FREE_MB" } - else if (\$2 == "space") {var = "TOTAL_MB" } + if (\$2 == "used") {var = "USED_MB"} + else if (\$2 == "avail") {var = "FREE_MB"} + else if (\$2 == "space") {var = "TOTAL_MB"} print var "=" space } @@ -69,4 +69,13 @@ $SUDO $RADOS df | $AWK '{ EOF ) -ssh_monitor_and_log $HOST "$MONITOR_SCRIPT" | tr ' ' '\n' +MONITOR_DATA=$(ssh_monitor_and_log $HOST "$MONITOR_SCRIPT" 2>&1) +MONITOR_STATUS=$? + +if [ "$MONITOR_STATUS" = "0" ]; then + echo "$MONITOR_DATA" | tr ' ' '\n' +else + echo "$MONITOR_DATA" + exit $MONITOR_STATUS +fi + diff --git a/src/datastore_mad/remotes/iscsi/monitor b/src/datastore_mad/remotes/iscsi/monitor index fbfc9552ba..e2450a4f7a 100755 --- a/src/datastore_mad/remotes/iscsi/monitor +++ b/src/datastore_mad/remotes/iscsi/monitor @@ -66,4 +66,12 @@ echo "FREE_MB=\$FREE_MB" EOF ) -ssh_monitor_and_log $HOST "$MONITOR_SCRIPT" | tr ' ' '\n' +MONITOR_DATA=$(ssh_monitor_and_log $HOST "$MONITOR_SCRIPT" 2>&1) +MONITOR_STATUS=$? + +if [ "$MONITOR_STATUS" = "0" ]; then + echo "$MONITOR_DATA" | tr ' ' '\n' +else + echo "$MONITOR_DATA" + exit $MONITOR_STATUS +fi diff --git a/src/datastore_mad/remotes/lvm/monitor b/src/datastore_mad/remotes/lvm/monitor index 2f704f0c52..17cb12c115 100755 --- a/src/datastore_mad/remotes/lvm/monitor +++ b/src/datastore_mad/remotes/lvm/monitor @@ -66,4 +66,12 @@ echo "FREE_MB=\$FREE_MB" EOF ) -ssh_monitor_and_log $HOST "$MONITOR_SCRIPT" | tr ' ' '\n' +MONITOR_DATA=$(ssh_monitor_and_log $HOST "$MONITOR_SCRIPT" 2>&1) +MONITOR_STATUS=$? + +if [ "$MONITOR_STATUS" = "0" ]; then + echo "$MONITOR_DATA" | tr ' ' '\n' +else + echo "$MONITOR_DATA" + exit $MONITOR_STATUS +fi diff --git a/src/datastore_mad/remotes/vmfs/monitor b/src/datastore_mad/remotes/vmfs/monitor index 61999a1940..6ced1f561c 100755 --- a/src/datastore_mad/remotes/vmfs/monitor +++ b/src/datastore_mad/remotes/vmfs/monitor @@ -68,4 +68,12 @@ echo "FREE_MB=\$FREE_MB" EOF ) -ssh_monitor_and_log $HOST "$MONITOR_SCRIPT" | tr ' ' '\n' +MONITOR_DATA=$(ssh_monitor_and_log $HOST "$MONITOR_SCRIPT" 2>&1) +MONITOR_STATUS=$? + +if [ "$MONITOR_STATUS" = "0" ]; then + echo "$MONITOR_DATA" | tr ' ' '\n' +else + echo "$MONITOR_DATA" + exit $MONITOR_STATUS +fi