ShowServerStatus.csp


<%@ Language=JavaScript%>

<%

// This file is called from ChooseServer.csp.  It shows metrics for the

// server that was chosen and allows the user to start, stop, restart,

// enable, or disable the server.

%>

<!-- #include file="RetrieveIStore.csp" -->

<!-- #include file=helper_js.csp -->

<html>

<body>

<%

    

function ShowServerStatus(IStore, ServerId)

// Show the status and metrics for a server.

{

    // Query for the server.

    var ServerInfoObject = IStore.Query("SELECT SI_NAME, SI_SERVER_IS_ALIVE, SI_DISABLED, SI_SERVER_KIND   FROM CI_SYSTEMOBJECTS WHERE SI_ID="+ServerId).Item(1);

    Response.Write ("Server: " + ServerInfoObject.Title + "<BR>");

    //Get the actual Server object.

    ServerObj=ServerInfoObject.PluginInterface("");

    

    // Print its status and general metrics.  General metrics

    // are available for all servers connected to the APS.

    Response.Write ("Enabled: " + !ServerObj.Disabled + "<BR>");

    Response.Write("Running: " + ServerObj.ServerIsAlive);

    Response.Write ("<HR><B>General metrics</B><BR>");

    Metrics = ServerObj.ServerGeneralAdmin;

    Response.Write ("CPU: " + Metrics.CPU+"<BR>");

    Response.Write ("CPU count: " + Metrics.CPUCount+"%<BR>");

    Response.Write ("Current time: " + Metrics.CurrentTime+"<BR>");

    Response.Write ("Server start time: " + Metrics.StartTime+"<BR>");

    Response.Write ("Available disk space: " + Metrics.DiskSpaceAvailable+" bytes<BR>");

    Response.Write ("Total disk space: " + Metrics.DiskSpaceTotal+" bytes<BR>");

    Response.Write ("Memory available: " + Metrics.Memory+" kilobytes<BR>");

    Response.Write ("Operating system: " + Metrics.OperatingSystem+"<BR>");

    Response.Write ("Server Version: " + Metrics.Version+"<BR>");

    

    // Print server specific metrics.  The ServerAdmin property

    // will return a different type of object depending on what kind

    // of server you are dealing with.

    switch(ServerObj.ServerKind)

    {

        case "aps":

            // Show metrics using the APSAdmin object.

            ShowAPSMetrics(ServerObj.ServerAdmin);

            break;

        case "fileserver":

            // Show metrics using the FileServerAdmin object.

            ShowFileServerMetrics(ServerObj.ServerAdmin);

            break;

        case "eventserver":

            // Show metrics using the EventServerAdmin object.

            ShowEventServerMetrics(ServerObj.ServerAdmin);

            break;

        case "pageserver":

            // Show metrics using the PageServerAdmin object.

            ShowPageServerMetrics(ServerObj.ServerAdmin);

            break;

        case "jobserver":

            // Show metrics using the JobServerAdmin object.

            ShowJobServerMetrics(ServerObj.ServerAdmin);

            break;

        case "cacheserver":

            // Show metrics using the CacheServerAdmin object.

            ShowCacheServerMetrics(ServerObj.ServerAdmin);

            break;

        case "wcs":

            // Show metrics using the WCSAdmin object.

            ShowWCSMetrics(ServerObj.ServerAdmin)

            break;

    }

}


function ShowAPSMetrics(ServerProperties)

// Show metrics using the APSAdmin object.

{

    Response.Write ("<HR><B>APS Metrics</B><BR>");

    Response.Write ("Build date: " + ServerProperties.APSBuildDate + "<BR>");

    Response.Write ("Database name: " + ServerProperties.APSDatabaseName + "<BR>");

    Response.Write ("Database server name: " + ServerProperties.APSDatabaseServerName + "<BR>");

    Response.Write ("Database user name: " + ServerProperties.APSDatabaseUserName + "<BR>");

    Response.Write ("Database source name: " + ServerProperties.APSDataSourceName + "<BR>");

    Response.Write ("Private build number: " + ServerProperties.APSPrivateBuildNumber + "<BR>");

    Response.Write ("Product version: " + ServerProperties.APSProductVersion + "<BR>");

    Response.Write ("Pending jobs: " + ServerProperties.PendingJobs + "<BR>");

    Response.Write ("Running jobs: " + ServerProperties.RunningJobs + "<BR>");

    Response.Write ("Successful jobs: " + ServerProperties.SuccessJobs + "<BR>");

    Response.Write ("Waiting jobs: " + ServerProperties.WaitingJobs + "<BR>");

    Response.Write ("Failed jobs: " + ServerProperties.FailedJobs + "<BR>");

    Response.Write ("<B>Cluster members:</B><UL>");

    for (k=1;k<=ServerProperties.ClusterMembers.Count;k++)

        Response.Write ("<LI>"+ServerProperties.ClusterMembers.Item(k));

    Response.Write ("</UL>");

    Response.Write ("Concurrent licenses: " + ServerProperties.LicensesConcurrent + "<BR>");

    Response.Write ("Named user licenses: " + ServerProperties.LicensesNamedUsers + "<BR>");

    Response.Write ("License processors: " + ServerProperties.LicensesProcessors + "<BR>");

    Response.Write ("Concurrent users connected: " + ServerProperties.UserConnectedConcurrent + "<BR>");

    Response.Write ("Named users connected: " + ServerProperties.UserConnectedNamedUsers + "<BR>");

    Response.Write ("Existing concurrent users: " + ServerProperties.UserExistingConcurrent + "<BR>");

    Response.Write ("Existing named users: " + ServerProperties.UserExistingNamedUsers + "<BR>");

    Response.Write ("Token connections: " + ServerProperties.UserTokenConnections + "<BR>");

    

}


function ShowWCSMetrics(ServerProperties)

// Show metrics using the WCSAdmin object.

{

    Response.Write ("<HR><B>WCS Metrics</B><BR>");

    Response.Write ("Average bytes: " + ServerProperties.AverageBytes + "<BR>");

    Response.Write ("Average request time: " + ServerProperties.AverageRequestTime + "<BR>");

    Response.Write ("Current requests: " + ServerProperties.CurrentRequests + "<BR>");

    Response.Write ("Logging on: " + ServerProperties.Logging + "<BR>");

    Response.Write ("Log path: " + ServerProperties.LogPath + "<BR>");

    Response.Write ("Single sign on enabled: " + ServerProperties.SingleSignOn + "<BR>");

    Response.Write ("Total bytes: " + ServerProperties.TotalBytes + "<BR>");

    Response.Write ("Total requests: " + ServerProperties.TotalRequests + "<BR>");

    Response.Write ("Total time taken: " + ServerProperties.TotalTime + "<BR>");

    Response.Write ("<B>Log fields:</B><UL>");

    for (k=1;k<=ServerProperties.LogFields.Count;k++)

    {

        var LogField = ServerProperties.LogFields.Item(k)

        Response.Write ("<LI>Identifier: " + LogField.Identifier + "<BR>");

        Response.Write ("Prefix: " + LogField.Prefix);

    }

    Response.Write ("</UL>");

}


function ShowCacheServerMetrics(ServerProperties)

// Show metrics using the CacheServerAdmin object.

{

    Response.Write ("<HR><B>Cache Server Metrics</B><BR>");

    Response.Write ("Bytes transfered: " + ServerProperties.BytesTransfered + "<BR>");

    Response.Write ("Cache size: " + ServerProperties.CacheSize + "<BR>");

    Response.Write ("Cache size update: " + ServerProperties.CacheSizeUpdate + "<BR>");

    Response.Write ("Connections: " + ServerProperties.Connections + "<BR>");

    Response.Write ("Directory: " + ServerProperties.Directory + "<BR>");

    Response.Write ("Drive space used: " + ServerProperties.DriveSpaceUsed + "<BR>");

    Response.Write ("Hit rate: " + ServerProperties.HitRate + "<BR>");

    Response.Write ("Maximum idle time: " + ServerProperties.MaxIdleTime + "<BR>");

    Response.Write ("Maximum idle time update: " + ServerProperties.MaxIdleTimeUpdate + "<BR>");

    Response.Write ("Maximum threads: " + ServerProperties.MaxThreads + "<BR>");

    Response.Write ("Queued requests: " + ServerProperties.QueuedRequests + "<BR>");

    Response.Write ("Refresh: " + ServerProperties.Refresh + "<BR>");

    Response.Write ("Refresh always hits the database: " + ServerProperties.RefreshAlwaysHitsDb + "<BR>");

    Response.Write ("Threads: " + ServerProperties.Threads + "<BR>");

    Response.Write ("Total requests: " + ServerProperties.TotalRequests + "<BR>");

    Response.Write ("<B>Page server connections</b><UL>");

    for(k=1;k<=ServerProperties.PageServerConnection.Count;k++)

    {

        var PageServerConnection = ServerProperties.PageServerConnection.Item(k);

        Response.Write ("<LI>Server name: " + PageServerConnection.ServerName+"<BR>");

        Response.Write ("Connections: " + PageServerConnection.Connections+"<BR>");

    }

}


function ShowJobServerMetrics(ServerProperties)

// Show metrics using the JobServerAdmin object.

{

    Response.Write ("<HR><B>Job Server Metrics</B><BR>");

    Response.Write ("Current jobs: " + ServerProperties.CurrentJobs + "<BR>");

    Response.Write ("DLLName: " + ServerProperties.DLLName + "<BR>");

    Response.Write ("Jobs that failed to create: " + ServerProperties.FailedCreated + "<BR>");

    Response.Write ("Maximum number of jobs allowed: " + ServerProperties.MaxJobs + "<BR>");

    Response.Write ("Object type name: " + ServerProperties.ObjectTypeName + "<BR>");

    Response.Write ("ProcType: " + ServerProperties.ProcType + "<BR>");

    Response.Write ("Temporary directory: " + ServerProperties.TempDir + "<BR>");

    Response.Write ("Total jobs: " + ServerProperties.TotalJobs + "<BR>");

    Response.Write ("<B>Supported destinations:</B><UL> ");

    for(k=1;k<=ServerProperties.Destinations.Count;k++)

    {

        var Destination = ServerProperties.Destinations.Item(k);

        Response.Write("<LI>Name: " + Destination.Name + "<BR>");

        Response.Write("Enabled: " + Destination.Enabled + "<BR>");

    }

}


function ShowPageServerMetrics(ServerProperties)

// Show metrics using the PageServerAdmin object.

{

    Response.Write ("<HR><B>Page Server Metrics</B><BR>");

    Response.Write ("Bytes transfered: " + ServerProperties.BytesTransfered + "<BR>");

    Response.Write ("Connections: " + ServerProperties.Connections + "<BR>");

    Response.Write ("Directory: " + ServerProperties.Directory + "<BR>");

    Response.Write ("Maximum idle time: " + ServerProperties.MaxIdleTime + "<BR>");

    Response.Write ("Maximum idle time update: " + ServerProperties.MaxIdleTimeUpdate + "<BR>");

    Response.Write ("Maximum threads: " + ServerProperties.MaxThreads + "<BR>");

    Response.Write ("Threads: " + ServerProperties.Threads + "<BR>");

    Response.Write ("Queued requests: " + ServerProperties.QueuedRequests + "<BR>");

    Response.Write ("Total requests: " + ServerProperties.TotalRequests + "<BR>");

}



function ShowFileServerMetrics(ServerProperties)

// Show metrics using the FileServerAdmin object.

{

    Response.Write ("<HR><B>File Server Metrics</B><BR>");

    Response.Write ("Percentage of disk available: " + ServerProperties.AvailableDiskPercent + "%<BR>");

    Response.Write ("Available disk space: " + ServerProperties.AvailableDiskSpace + " bytes<BR>");

    Response.Write ("Total disk space: " + ServerProperties.TotalDiskSpace + " bytes<BR>");

    Response.Write ("Bytes sent: " + ServerProperties.BytesSent + " bytes<BR>");

    Response.Write ("Bytes written: " + ServerProperties.BytesWritten + " bytes<BR>");

    Response.Write ("Client connections: " + ServerProperties.ClientConnections + "<BR>");

    Response.Write ("Disk space left: " + ServerProperties.DiskSpaceLeft + " bytes<BR>");

    Response.Write ("Host name: " + ServerProperties.HostName + "<BR>");

    Response.Write ("Maximum idle time: " + ServerProperties.MaxIdleTime + "<BR>");

    Response.Write ("Root directory: " + ServerProperties.RootDirectory + "<BR>");


    Response.Write ("<HR><B>Active files</B><UL>");

    for(k=1;k<=ServerProperties.ListActiveFiles.Count;k++)

    {

        var FRSAdminFile = ServerProperties.ListActiveFiles.Item(k);

        Response.Write ("<LI>File name: " + FRSAdminFile.FileName);

        Response.Write ("<LI>File name: " + FRSAdminFile.Readers);

        Response.Write ("<LI>File name: " + FRSAdminFile.Writers);


    }

}


function ShowEventServerMetrics(ServerProperties)

// Show metrics using the EventServerAdmin object.

{

    Response.Write ("<HR><B>Event Server Metrics</B><BR>");

    Response.Write ("Events: " + ServerProperties.Events + "<BR>");

    Response.Write ("File poll time: " + ServerProperties.FilePollTime + "<BR>");

    Response.Write ("Host name: " + ServerProperties.HostName + "<BR>");

    Response.Write ("<B>Monitored files</B><UL>");

    for(k=1;k<=ServerProperties.ListFileMonitored.Count;k++)

    {

        var EventServerAdminFile = ServerProperties.ListFileMonitored.Item(k);

        Response.Write ("<LI>"+EventServerAdminFile.FileName);

        Response.Write ("<LI>"+EventServerAdminFile.LastNotifiedTime);

    }

    Response.Write ("</UL>");

}




function Main()

{

    IStore = RetrieveIStore();

    if (IStore == null)

    {

        Response.Redirect ("Start.csp");

        return;

    }

    Response.Write ("<H2>Server status</H2>");

    ServerId = Request.Form.Item("ServerId");

    Response.Write ("<form action='ManipulateServer.csp?ServerId="+ServerId+"' method=post name='Server'>");

    // Buttons for starting, stopping, enabling, disabling and restarting the server.

    Response.Write ("<input type=submit name='Stop' value='Stop'>");

    Response.Write ("<input type=submit name='Start' value='Start'>");

    Response.Write ("<input type=submit name='Enable' value='Enable'>");

    Response.Write ("<input type=submit name='Disable' value='Disable'>");

    Response.Write ("<input type=submit name='Restart' value='Restart'>");

    Response.Write("<HR>");

    ShowServerStatus(IStore, ServerId);

    Response.Write ("</FORM>");

}


Main();

    

%>

</body>

</html>




Crystal Decisions, Inc.
http://www.crystaldecisions.com
Support services:
http://support.crystaldecisions.com