diff --git a/check_mdb b/check_mdb index 69ec22e..3c04aae 100755 --- a/check_mdb +++ b/check_mdb @@ -90,7 +90,7 @@ do esac done -CMD="$MDB_STAT -e $DB_PATH" +CMD="$MDB_STAT -ef $DB_PATH" debug "mdb_stat command = '$CMD'" if [ -n "$SUDO_USER" ] @@ -111,6 +111,11 @@ then exit 3 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/' ) 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