Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 29 Jun 2008 21:32:45 +0100
From:      Vince Hoffman <jhary@unsane.co.uk>
To:        "Diego F. Arias R." <dak.col@gmail.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: Problem With ZFS script
Message-ID:  <4867F16D.3000700@unsane.co.uk>
In-Reply-To: <3b93bd110806290517k2050b114g984b9e4186a3beda@mail.gmail.com>
References:  <3b93bd110806290517k2050b114g984b9e4186a3beda@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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.




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4867F16D.3000700>