[rrd-users] Re: How get CPU and Memory values

Jason Lewis jlewis at packetnexus.com
Sat Oct 8 01:15:59 MEST 2005


 From the man page:

man 5 proc

/proc/stat
               kernel/system statistics.  Varies with architecture. 
Common entries include:
               cpu  3357 0 4313 1362393
                      The number of jiffies (1/100ths of a second) that 
the system spent in user mode, user mode with low  priority  (nice), 
system  mode, and the idle task, respectively.  The last value should be 
100 times the second entry in the uptime pseudo-file.


I use this.

my $uptime  = `cat /proc/stat |grep "cpu "`;
chomp($uptime);
($trash,$user,$system,$nice,$idle) = split("\ ",$uptime);

I then put user,system,nice and idle into an RRD every five minutes. 
This isn't precise but it gives a good idea of what is going on.

jas

Dave Lugo wrote:
> On Fri, 7 Oct 2005, Serge Maandag wrote:
> 
>>This may be like stating the obvious to some, but remember that
>>load is not the same as cpu usage.
>>
>>The load is the number of processes waiting to be run.
>>They can be waiting for cpu, but also for disk I/O.
>>
>>I've seen loads of 700 and up on busy systems. That is also
>>about the moment top doesn't work anymore, so you'll have to
>>use `who` or `vmstat`.
>>
> 
> 
> 
> You're correct, it's not.  But the question was perhaps a bit
> ambiguous:
> 
>   "But how can I calculate the processor load with the numbers from
>   /proc/stat"
> 
> regards,
> 
> Dave
> 

--
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