1) That is not the real time screen. That's the "Server Stats and Reports" page.
2) It's not "Live" (it does not change until you refresh the page)
3) We have not found those numbers to be indicative of "it's about to overload! do something!" whereas "Average Server Load" seems to be a pretty good predictor.
4) The Real Time Screen, on the other hand, has actual server load values in it for the server on which it is running:
- Code: Select all
+----------------+------------------------+-----------+----------+---------+
4 agents logged in on all servers
System Load Average: 0.38 0.27 0.14 M
Those values are based on how many cores are "busy" on average for the last 1,5,10 minutes. Whether you are at 100% or 50% or 25% would be based on how many cores you have. EG: If you have 4 cores, and the load average shows 2.0, that's 50%.
If you prefer to use the load averages on the reports page (which do not auto-refresh), you should check this code (in AST_update.pl) to see if you want to rely upon them:
- Code: Select all
{
$UD_bad_grab=0;
if ( ( ($endless_loop =~ /0$/) && ($SYSPERF) ) || ($endless_loop =~ /00$/) || ($gather_stats_first >= 1) )
{
$cpuUSERcent=0; $cpuSYSTcent=0; $cpuIDLEcent=0;
### get processor usage seconds ###
# cpu 924841 211725 270473 6961811
@cpuUSE = `$bincat /proc/stat`;
if ($cpuUSE[0] =~ /cpu\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)/)
{
$cpuUSER = ($1 + $2);
$cpuSYST = $3;
$cpuIDLE = $4;
$cpuUSERdiff = ($cpuUSER - $cpuUSERprev);
$cpuSYSTdiff = ($cpuSYST - $cpuSYSTprev);
$cpuIDLEdiff = ($cpuIDLE - $cpuIDLEprev);
$cpuIDLEdiffTOTAL = (($cpuUSERdiff + $cpuSYSTdiff) + $cpuIDLEdiff);
if ($cpuIDLEdiffTOTAL > 0)
{
$cpuUSERcent = sprintf("%.0f", (($cpuUSERdiff / $cpuIDLEdiffTOTAL) * 100));
$cpuSYSTcent = sprintf("%.0f", (($cpuSYSTdiff / $cpuIDLEdiffTOTAL) * 100));
$cpuIDLEcent = sprintf("%.0f", (($cpuIDLEdiff / $cpuIDLEdiffTOTAL) * 100));
}
$cpuUSERprev=$cpuUSER;
$cpuSYSTprev=$cpuSYST;
$cpuIDLEprev=$cpuIDLE;
}
### get system load ###
$serverLOAD = `$bincat /proc/loadavg`;
$serverLOAD =~ s/ .*//gi;
$serverLOAD =~ s/\D//gi;
### get memory usage ###
@GRABserverMEMORY = `$binfree -m -t`;
if ($GRABserverMEMORY[1] =~ /Mem:\s+(\d+)\s+(\d+)\s+(\d+)\s+/)
{
$MEMused = $2;
$MEMfree = $3;
}
### get number of system processes ###
@GRABserverPROCESSES = `$binps -A --no-heading`;
$serverPROCESSES = $#GRABserverPROCESSES;
if ($SYSPERF_rec) {$recording_count = ($test_local_count / 2)}
else {$recording_count=0;}
if ($SYSPERF)
{
if ($SYSPERFDB)
{print "$serverLOAD $MEMfree $MEMused $serverPROCESSES $#list_channels $cpuUSERcent $cpuSYSTcent $cpuIDLEcent\n";}
$stmtA = "INSERT INTO server_performance (start_time,server_ip,sysload,freeram,usedram,processes,channels_total,trunks_total,clients_total,clients_zap,clients_iax,clients_local,clients_sip,live_recordings,cpu_user_percent,cpu_system_percent,cpu_idle_percent) values('$now_date','$server_ip','$serverLOAD','$MEMfree','$MEMused','$serverPROCESSES','$#list_channels','$channel_counter','$sip_counter','$test_zap_count','$test_iax_count','$test_local_count','$test_sip_count','$recording_count','$cpuUSERcent','$cpuSYSTcent','$cpuIDLEcent')";
if( ($DB) or ($UD_bad_grab) ){print STDERR "\n|$stmtA|\n";}
$affected_rows = $dbhA->do($stmtA) or die "Couldn't execute query: |$stmtA|\n";
}
if ( ($endless_loop =~ /00$/) || ($gather_stats_first >= 1) )
{
### get disk space usage ###
$disk_usage='';
@serverDISK = `$dfbin -B 1048576`;
#Filesystem 1M-blocks Used Available Use% Mounted on
#/dev/sda1 30030 6867 21613 0% /
$gather_stats_first=0;
$channels_total=0;
if ($#list_channels > 0)
{$channels_total = ($#list_channels - 1);}
$ct=0; $ct_PCT=0;
foreach(@serverDISK)
{
if ($serverDISK[$ct] =~ /(\d+\%)/)
{
$ct_PCT++;
$usage = $1;
$usage =~ s/\%//gi;
$disk_usage .= "$ct_PCT $usage|";
}
$ct++;
}
$stmtA = "UPDATE servers SET sysload='$serverLOAD',channels_total='$channels_total',cpu_idle_percent='$cpuIDLEcent',disk_usage='$disk_usage' where server_ip='$server_ip';";
if( ($DB) or ($UD_bad_grab) ){print STDERR "\n|$stmtA|\n";}
$affected_rows = $dbhA->do($stmtA) or die "Couldn't execute query: |$stmtA|\n";
}
}
}
Happy Hunting!