Problem With ZFS script

Vince Hoffman jhary at unsane.co.uk
Sun Jun 29 20:33:59 UTC 2008


Diego F. Arias R. wrote:
> Hi:
> 
> Im testing the new ZFS feature on freebsd. On the page i got a script
> to monitor kernel memory but the script dont works.
> ---------------------------------------------------------------------------------------------------------------------------------------------------
> #!/bin/sh -
> 
> TEXT=kldstat | tr a-f A-F | awk 'BEGIN {print "ibase=16"}; NR > 1
> {print $4}' | bc | awk '{a+=$1}; END {print a}'
> DATA=vmstat -m | sed 's/K//' | awk '{a+=$3}; END {print a*1024}'
> TOTAL=echo $DATA $TEXT | awk '{print $1+$2}'
> 
> echo TEXT=$TEXT, echo $TEXT | awk '{print $1/1048576 " MB"}'
> echo DATA=$DATA, echo $DATA | awk '{print $1/1048576 " MB"}'
> echo TOTAL=$TOTAL, echo $TOTAL | awk '{print $1/1048576 " MB"}'
> ---------------------------------------------------------------------------------------------------------------------------------------------------
> 
> link:
> 
> http://wiki.freebsd.org/ZFSTuningGuide
> 
> 
> 
> the error i got is
> 
> freebsd# ./kernmem.sh
> 
> -m: not found
> 
> 

try
----------------------
#!/bin/sh -

TEXT=$(kldstat | tr a-f A-F | \
awk 'BEGIN {print "ibase=16"}; NR > 1 {print $4}'\
| bc | awk '{a+=$1}; END {print a}')
DATA=$(vmstat -m | sed 's/K//' | awk '{a+=$3}; END {print a*1024}')
TOTAL=$(echo "$DATA $TEXT" | awk '{print $1+$2}')

echo "TEXT=$TEXT, $(echo $TEXT | awk '{print $1/1048576 " MB"}')"
echo "DATA=$DATA, $(echo $DATA | awk '{print $1/1048576 " MB"}')"
echo "TOTAL=$TOTAL, $(echo $TOTAL | awk '{print $1/1048576 " MB"}')"
------------------------------------------------------
Looks like the wiki stripped some formatting.


Vince
> 
> Thanks.



More information about the freebsd-questions mailing list