[rrd-users] Re: CPU usage RRD-DS Please help

Fabien Wernli wernli at in2p3.fr
Fri Oct 13 14:15:21 MEST 2006


On Fri, Oct 13, 2006 at 10:05:38AM +0900, Mr. Suhas Ghosh wrote:
> Hi all.
>     I want to display CPU usage graph(perl script+rrdtool)
>     1. 6h
>     2. 1day
>     3.1week.
>     4. 1 month
>     5. 1 year.
>     I want to collect data from /proc/stat.
>     I am using these command
> my $usr = `cat /proc/stat | grep "cpu" --max-count=1 |cut -d" " -f3|cut -d"
> " -f2 |sed 's/ //g'`;

although this is not perl either may I recommend using:

| awk 'BEGIN {printf "%s",systime()}/^cpu[^0-9]+/{printf ":%s:%s:%s:%s:%s:%s:%s",$2,$3,$4,$7,$8,$6,$5} END {printf " "}' /proc/stat

--
Unsubscribe mailto:rrd-users-request at list.ee.ethz.ch?subject=unsubscribe
Help        mailto:rrd-users-request at list.ee.ethz.ch?subject=help
Archive     http://lists.ee.ethz.ch/rrd-users
WebAdmin    http://lists.ee.ethz.ch/lsg2.cgi



More information about the rrd-users mailing list