Freitag, 6. November 2009

Load Average


in every unix we have the load average, that's util when you want know the load in your server. We can see with uptime, procinfo, w, top, or simply cat /proc/loadavg

sender@hwhg:~$ uptime
15:29:50 up 28 min, 2 users, load average: 0.00, 0.02, 0.09

sender@hwhg:~$ procinfo
Memory: Total Used Free Buffers
RAM: 891304 734260 157044 26348
Swap: 1461872 0 1461872

Bootup: Fri Nov 6 15:01:35 2009 Load average: 0.14 0.09 0.09 2/253 2304
...

sender@hwhg:~$ cat /proc/loadavg
0.20 0.10 0.10 ...

the first three numbers represent the number of active tasks on the system, processes that are actually running, averaged over the last 1, 5, and 15 minutes. But this load in this context refers to run-queue length.

a useful and simple script for show the load average in the title of xterm

#!/usr/bin/perl -w
$|++;
while (1) { open (LOAD,"/proc/loadavg") || die "error al leer puntos de carga\n";
my @load=split(/ /,);
close (LOAD);
print "\033]0;$load[0] $load[1] $load[2]\007";
sleep 10;
}

0 Kommentare:

Kommentar veröffentlichen