divisor = $divisor; $this->nextUnit = $nextUnit; } } $timeFormattingData = array(); $timeFormattingData[ MILLISECONDS ] = new TimeUnitFormattingData( 1000, SECONDS ); $timeFormattingData[ SECONDS ] = new TimeUnitFormattingData( 60, MINUTES ); $timeFormattingData[ MINUTES ] = new TimeUnitFormattingData( 60, HOURS ); $timeFormattingData[ HOURS ] = new TimeUnitFormattingData( 24, DAYS ); $timeFormattingData[ DAYS ] = new TimeUnitFormattingData( 7, WEEKS ); function FormatTime( $originalTime, $originalUnit ) { global $timeFormattingData; $formattedTime = $originalTime; $formattedUnit = $originalUnit; $timeFormattingStr = "%f %s"; foreach ( $timeFormattingData as $unit => $data ) { if ( $formattedUnit == $unit && $formattedTime > $data->divisor ) { $formattedTime /= $data->divisor; $formattedUnit = $data->nextUnit; } } return sprintf( $timeFormattingStr, $formattedTime, $formattedUnit ); } class ServerHealthPageRecord { var $timeStamp; var $cpuUtilization; var $upTime; var $adminOpsQueueSize; var $clientOpsQueueSize; var $siteOpsQueueSize; var $avgClientOpTime; var $totalOpTime; var $totalPhysicalMemory; var $physicalMemoryUsed; var $totalVirtualMemory; var $virtualMemoryUsed; function ServerHealthPageRecord() { $this->timeStamp = 0; $this->cpuUtilization = 0; $this->upTime = 0; $this->adminOpsQueueSize = 0; $this->clientOpsQueueSize = 0; $this->siteOpsQueueSize = 0; $this->avgClientOpTime = 0; $this->totalOpTime = 0; $this->totalPhysicalMemory = 0; $this->physicalMemoryUsed = 0; $this->totalVirtualMemory = 0; $this->virtualMemoryUsed = 0; } function GetProps( $serverAdmin ) { $this->timeStamp = date( "D, j M Y, g:i:s a T" ); $props = $serverAdmin->GetInformationProperties(); $prop = $props->GetItem( MgServerInformationProperties::CpuUtilization ); $this->cpuUtilization = $prop->GetValue(); $prop = $props->GetItem( MgServerInformationProperties::Uptime ); $this->upTime = $prop->GetValue(); $prop = $props->GetItem( MgServerInformationProperties::AdminOperationsQueueCount ); $this->adminOpsQueueSize = $prop->GetValue(); $prop = $props->GetItem( MgServerInformationProperties::ClientOperationsQueueCount ); $this->clientOpsQueueSize = $prop->GetValue(); $prop = $props->GetItem( MgServerInformationProperties::SiteOperationsQueueCount ); $this->siteOpsQueueSize = $prop->GetValue(); $prop = $props->GetItem( MgServerInformationProperties::AverageOperationTime ); $this->avgClientOpTime = $prop->GetValue(); $prop = $props->GetItem( MgServerInformationProperties::TotalOperationTime ); $this->totalOpTime = $prop->GetValue(); $prop = $props->GetItem( MgServerInformationProperties::TotalProcessedOperations ); $this->totalOpsProcessed = $prop->GetValue(); $prop = $props->GetItem( MgServerInformationProperties::TotalReceivedOperations ); $this->totalOpsReceived = $prop->GetValue(); $prop = $props->GetItem( MgServerInformationProperties::TotalPhysicalMemory ); $this->totalPhysicalMemory = $prop->GetValue(); $prop = $props->GetItem( MgServerInformationProperties::AvailablePhysicalMemory ); $physicalMemoryAvailable = $prop->GetValue(); $this->physicalMemoryUsed = $this->totalPhysicalMemory - $physicalMemoryAvailable; $prop = $props->GetItem( MgServerInformationProperties::TotalVirtualMemory ); $this->totalVirtualMemory = $prop->GetValue(); $prop = $props->GetItem( MgServerInformationProperties::AvailableVirtualMemory ); $virtualMemoryAvailable = $prop->GetValue(); $this->virtualMemoryUsed = $this->totalVirtualMemory - $virtualMemoryAvailable; } function DisplayValsOnPage() { $formattedUpTime = FormatTime( $this->upTime, SECONDS ); echo ' ', "\n"; echo ' ',"\n"; echo ' ',"\n"; echo ' ',"\n"; echo ' ',"\n"; echo ' ',"\n"; echo ' ',"\n"; echo ' ',"\n"; echo ' ',"\n"; echo ' ',"\n"; echo ' ',"\n"; echo ' ',"\n"; echo ' ',"\n"; echo ' ',"\n"; echo ' ',"\n"; echo ' ',"\n"; echo ' ',"\n"; echo ' ',"\n"; echo ' ',"\n"; echo ' ',"\n"; echo ' ',"\n"; echo ' ',"\n"; echo ' ',"\n"; echo ' ',"\n"; echo ' ',"\n"; echo ' ',"\n"; echo ' ',"\n"; echo ' ',"\n"; echo ' ',"\n"; echo ' ',"\n"; echo ' ',"\n"; echo ' ',"\n"; echo ' ',"\n"; echo ' ',"\n"; echo ' ',"\n"; echo ' ',"\n"; echo ' ',"\n"; echo ' ',"\n"; echo ' ',"\n"; echo ' ',"\n"; echo ' ',"\n"; echo ' ',"\n"; echo ' ',"\n"; echo ' ',"\n"; echo ' ',"\n"; echo ' ',"\n"; echo ' ',"\n"; echo ' ',"\n"; echo ' ',"\n"; echo ' ',"\n"; echo ' ',"\n"; echo ' ',"\n"; echo ' ',"\n"; echo ' ',"\n"; echo ' ',"\n"; echo ' ',"\n"; echo ' ',"\n"; echo ' ',"\n"; echo ' ',"\n"; echo ' ',"\n"; echo ' ',"\n"; echo ' ',"\n"; echo ' ',"\n"; echo ' ',"\n"; echo ' ',"\n"; echo ' ',"\n"; echo '
Time of status check:',$this->timeStamp,'
 
CPU usage:',$this->cpuUtilization,'%
Up time:',$formattedUpTime,'
 
Admin operations queued:',$this->adminOpsQueueSize,'
Client operations queued:',$this->clientOpsQueueSize,'
Site operations queued:',$this->siteOpsQueueSize,'
Average client operation time:',$this->avgClientOpTime,' milliseconds
Total operation time:',$this->totalOpTime,' seconds
Total operations processed:',$this->totalOpsProcessed,'
Total operations received:',$this->totalOpsReceived,'
 
Total physical memory:',$this->totalPhysicalMemory/1024,' KB
Physical memory used:',$this->physicalMemoryUsed/1024,' KB
Total virtual memory:',$this->totalVirtualMemory/1024,' KB
Virtual memory used:',$this->virtualMemoryUsed/1024,' KB
',"\n"; } } // Define Local values $pageTitle = ""; $pageName = 'ViewServerBottomPage'; $formName = 'ViewServerBottomForm'; $confirmationMsg = ""; $errorMsg = ""; $serverStatus = new ServerHealthPageRecord(); // Get Server $serverRec = GetDataForServer( $selectedServer ); if ( $serverRec == NULL ) throw new Exception( sprintf( $errNotFound, $selectedServer ) ); if ( !$serverRec->poweredUp ) throw new Exception( sprintf( $errServerIsDown, $selectedServer ) ); // Get Server Status $serverAdmin = new MgServerAdmin(); $serverAdmin->Open( $selectedServer, $userInfo ); $serverStatus->GetProps( $serverAdmin ); $serverAdmin->Close(); } catch ( MgException $e ) { CheckForFatalMgException( $e ); if ( empty( $errorMsg ) ) $errorMsg = $e->GetMessage(); } catch ( Exception $e ) { if ( empty( $errorMsg ) ) $errorMsg = $e->getMessage(); } ?> >
This window is in auto refresh mode.
This window is in manual refresh mode.
DisplayValsOnPage();  ?>