[mrtg] Re: CPU and Memory utilization

Takumi Yamane yamtak at b-session.com
Wed Aug 4 15:35:04 MEST 2004


On Wed, 4 Aug 2004 14:43:13 +0200, "Stefano Giraldo" wrote 
in <011701c47a20$9f77fec0$e1275cd5 at inet.it>:
>
> try this shell script:
> 
> #!/bin/bash
> top -b -n 1 > /etc/script_mrtg/noir_top.txt
> sed 's/%/0/g' /etc/script_mrtg/noir_top.txt \
>   > /etc/script_mrtg/noir_top1.txt
> PL=$(cat /etc/script_mrtg/noir_top1.txt | grep "CPU states:" | \
>   awk '{print$9}')
> CU=$(echo 100-$PL | bc)
> echo "$CU"

top -b -n 1 | \
  awk '/^CPU states:/ { gsub("%", ""); print (100 - int($9))}'

--
Takumi Yamane <yamtak at b-session.com>

--
Unsubscribe mailto:mrtg-request at list.ee.ethz.ch?subject=unsubscribe
Archive     http://www.ee.ethz.ch/~slist/mrtg
FAQ         http://faq.mrtg.org    Homepage     http://www.mrtg.org
WebAdmin    http://www.ee.ethz.ch/~slist/lsg2.cgi



More information about the mrtg mailing list