1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-22 18:50:08 +03:00

[PATCH] 3 small updates to fix the monitor script

There are some inconsistent variables and some unescaped special characters that prevent this script from working for me.
This commit is contained in:
JackZielke 2015-03-04 16:42:01 -05:00 committed by Ruben S. Montero
parent fa21ed168e
commit 7d4226caaa

View File

@ -61,7 +61,7 @@ if [ -z "$HOST" ]; then
fi
if [ -n "$CEPH_USER" ]; then
RADOS="$RADOS --id ${CEPH_USER}"
CEPH="$CEPH --id ${CEPH_USER}"
fi
# ------------ Compute datastore usage -------------
@ -72,8 +72,8 @@ to_mb() {
units=\$(echo "\$1" | sed 's/^[0123456789]*//g' | tr '[:upper:]' '[:lower:]')
case "\$units" in
t|tb) value=\$(expr \$value * 1024 * 1024) ;;
g|gb) value=\$(expr \$value * 1024) ;;
t|tb) value=\$(expr \$value \* 1024 \* 1024) ;;
g|gb) value=\$(expr \$value \* 1024) ;;
m|mb) value=\$value ;;
k|kb) value=\$(expr \$value / 1024) ;;
b|'') value=0 ;;
@ -82,7 +82,7 @@ to_mb() {
echo "\$value"
}
MAXAVAIL=\$($CEPH df | grep "$POOL_NAME" | awk '{print \$5}')
MAX_AVAIL=\$($CEPH df | grep "$POOL_NAME" | awk '{print \$5}')
USED=\$($CEPH df | grep "$POOL_NAME" | awk '{print \$3}')
USED_MB=\$(to_mb \$USED)