ZFSFreeMem

-- ################################################
-- # Creator: Cyrille Modiano
-- # Created: 2011/24/02
-- # Name: ZFSFreeMem
-- ################################################
-- #
-- # Compatible: Solaris 10 with ZFS cache
-- #
-- ################################################
-- #
-- # This script returns the free memory size and his
-- # percentage on a solaris 10 host with ZFS cache
-- # More info et best practices:
-- # _http://www.solarisinternals.com/wiki/index.php/ZFS_Best_Practices_Guide
-- ################################################
 
# Memory available on server
typeset -i MEM=`prtconf | grep Memory | awk '{print $3}'`

# ZFS cache size in Mo
typeset -i CACHE=`kstat zfs:0:arcstats:c_max zfs:0:arcstats::c_max zfs:0:arcstats:size | grep size | awk '{print $2}'`/1024/1024

# Free memory
typeset -i FREE=$MEM-\($MEM-$CACHE\)

# Free memory pct
typeset -i PCT=$FREE*100/$MEM

echo Libre : $FREE Mo \($PCT%\)

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.