Live Server Status Display

Discussions about new features or changes in existing features

Moderators: gerski, enjay, williamconley, Op3r, Staydog, gardo, mflorell, MJCoate, mcargile, Kumba, Michael_N

Live Server Status Display

Postby carpenox » Sat Oct 31, 2020 2:13 pm

How difficult would it be to add an option to the real time screen as a drop down under display options(carrier stats, agent time, etc) to have the server status(+time) shown in real time that updates as the stats do?

Nox
Alma Linux 9.3 | Version: 2.14-911a | SVN Version: 3815 | DB Schema Version: 1710 | Asterisk 18.18.1
www.dialer.one -:- 1-833-DIALER-1 -:- https://linktr.ee/CyburDial -:- WhatsApp: +19549477572 -:- Skype: live:carpenox_3
carpenox
 
Posts: 2230
Joined: Wed Apr 08, 2020 2:02 am
Location: Coral Springs, FL

Re: Live Server Status Display

Postby williamconley » Fri Nov 20, 2020 4:07 pm

Depends on what you mean by "server status". And of course "+time". Note that in a single server system that will be easier than a cluster, since you are communicating with the web server and not the dialer or DB (and only ONE web server if there are multiple).

Server Status as in "System Load Average" is already shown at the bottom of the real time screen.
Vicidial Installation and Repair, plus Hosting and Colocation
Newest Product: Vicidial Agent Only Beep - Beta
http://www.PoundTeam.com # 352-269-0000 # +44(203) 769-2294
williamconley
 
Posts: 20018
Joined: Wed Oct 31, 2007 4:17 pm
Location: Davenport, FL (By Disney!)

Re: Live Server Status Display

Postby carpenox » Sat Nov 21, 2020 8:46 am

I was thinking more along the lines of real time load:

Image
Alma Linux 9.3 | Version: 2.14-911a | SVN Version: 3815 | DB Schema Version: 1710 | Asterisk 18.18.1
www.dialer.one -:- 1-833-DIALER-1 -:- https://linktr.ee/CyburDial -:- WhatsApp: +19549477572 -:- Skype: live:carpenox_3
carpenox
 
Posts: 2230
Joined: Wed Apr 08, 2020 2:02 am
Location: Coral Springs, FL

Re: Live Server Status Display

Postby williamconley » Sat Nov 21, 2020 11:42 am

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! 8-)
Vicidial Installation and Repair, plus Hosting and Colocation
Newest Product: Vicidial Agent Only Beep - Beta
http://www.PoundTeam.com # 352-269-0000 # +44(203) 769-2294
williamconley
 
Posts: 20018
Joined: Wed Oct 31, 2007 4:17 pm
Location: Davenport, FL (By Disney!)

Re: Live Server Status Display

Postby carpenox » Sat Nov 21, 2020 3:31 pm

Bill,

I know that was from the reports page, the original question was if it was possible to put those stats into the real time screen to be refreshed at whatever time frame indicated on the refresh rate. Like the recently added Parked Call stats and such.

-Nox
Alma Linux 9.3 | Version: 2.14-911a | SVN Version: 3815 | DB Schema Version: 1710 | Asterisk 18.18.1
www.dialer.one -:- 1-833-DIALER-1 -:- https://linktr.ee/CyburDial -:- WhatsApp: +19549477572 -:- Skype: live:carpenox_3
carpenox
 
Posts: 2230
Joined: Wed Apr 08, 2020 2:02 am
Location: Coral Springs, FL


Return to Features

Who is online

Users browsing this forum: No registered users and 27 guests