Fix method to retrieve and compute real used pages (used - free pages)
This commit is contained in:
parent
4cf080a81d
commit
9b8ef00ac6
1 changed files with 6 additions and 1 deletions
|
@ -90,7 +90,7 @@ do
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
CMD="$MDB_STAT -e $DB_PATH"
|
CMD="$MDB_STAT -ef $DB_PATH"
|
||||||
debug "mdb_stat command = '$CMD'"
|
debug "mdb_stat command = '$CMD'"
|
||||||
|
|
||||||
if [ -n "$SUDO_USER" ]
|
if [ -n "$SUDO_USER" ]
|
||||||
|
@ -111,6 +111,11 @@ then
|
||||||
exit 3
|
exit 3
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
raw_used_pages=$( echo -e "$OUTPUT"|grep -E '^ +Number of pages used: '|sed 's/^ \+Number of pages used: \([0-9]\+\)$/\1/' )
|
||||||
|
free_pages=$( echo -e "$OUTPUT"|grep -E '^ +Free pages: '|sed 's/^ \+Free pages: \([0-9]\+\)$/\1/' )
|
||||||
|
let used_pages=raw_used_pages-free_pages
|
||||||
|
debug "Used/free pages: $raw_used_pages / $free_pages. Real used pages: $used_pages"
|
||||||
|
|
||||||
max_pages=$( echo -e "$OUTPUT"|grep -E '^ +Max pages: '|sed 's/^ \+Max pages: \([0-9]\+\)$/\1/' )
|
max_pages=$( echo -e "$OUTPUT"|grep -E '^ +Max pages: '|sed 's/^ \+Max pages: \([0-9]\+\)$/\1/' )
|
||||||
used_pages=$( echo -e "$OUTPUT"|grep -E '^ +Number of pages used: '|sed 's/^ \+Number of pages used: \([0-9]\+\)$/\1/' )
|
used_pages=$( echo -e "$OUTPUT"|grep -E '^ +Number of pages used: '|sed 's/^ \+Number of pages used: \([0-9]\+\)$/\1/' )
|
||||||
let perc_used=$used_pages*100/$max_pages
|
let perc_used=$used_pages*100/$max_pages
|
||||||
|
|
Loading…
Reference in a new issue