There are basically two types of metrics that you can retrieve for a server. The first are general metrics that all servers have; the second are metrics specific to a type of server, for example the WCS, or the File Repository Server. To retrieve the general metrics for the server, use the Server object's ServerGeneralAdmin property. For example, the following prints the server metrics for any server:
Metrics = Server.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>");
To get metrics that are specific to a server, you must first know what kind of server you are dealing with. The Server.ServerKind property is used to know what kind of server, the Server object is representing. The ServerAdmin property returns an object containing server metrics: this object will be different depending on the server kind. In the basic installation of Crystal Enterprise with reports, the following table shows what the ServerKind is and what the corresponding object that the ServerAdmin property will return:
ServerKind | Object | Description |
---|---|---|
For example, the following segment of code, checks to see what server object has been retrieved and prints information particular to that server:
function ShowServerStatus(IStore, ServerId)
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>");
ServerObj=ServerInfoObject.PluginInterface("");
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>");
ShowAPSMetrics(ServerObj.ServerAdmin);
ShowFileServerMetrics(ServerObj.ServerAdmin);
ShowEventServerMetrics(ServerObj.ServerAdmin);
ShowPageServerMetrics(ServerObj.ServerAdmin);
ShowJobServerMetrics(ServerObj.ServerAdmin);
ShowCacheServerMetrics(ServerObj.ServerAdmin);
ShowWCSMetrics(ServerObj.ServerAdmin)
function ShowAPSMetrics(ServerProperties)
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 ("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)
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++)
Response.Write ("<LI>Identifier: " + ServerProperties.LogFields.Item(k).Identifier + "<BR>");
Response.Write ("Prefix: " + ServerProperties.LogFields.Item(k).Prefix);
function ShowCacheServerMetrics(ServerProperties)
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 ("Directory update: " + ServerProperties.DirectoryUpdate + "<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 ("Maximum threads update: " + ServerProperties.MaxThreadsUpdate + "<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 ("Refresh update: " + ServerProperties.RefreshUpdate + "<BR>");
Response.Write ("Server load: " + ServerProperties.ServerLoad + "<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++)
Response.Write ("<LI>Server name: " + ServerProperties.PageServerConnection.Item(k).ServerName+"<BR>");
Response.Write ("Connections: " + ServerProperties.PageServerConnection.Item(k).Connections+"<BR>");
function ShowJobServerMetrics(ServerProperties)
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 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++)
Response.Write("<LI>Name: " + ServerProperties.Destinations.Item(k).Name + "<BR>");
Response.Write("Enabled: " + ServerProperties.Destinations.Item(k).Enabled + "<BR>");
function ShowPageServerMetrics(ServerProperties)
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 ("Directory update: " + ServerProperties.DirectoryUpdate + "<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 ("Maximum threads update: " + ServerProperties.MaxThreadUpdate + "<BR>");
Response.Write ("Threads: " + ServerProperties.Threads + "<BR>");
Response.Write ("Queued requests: " + ServerProperties.QueuedRequests + "<BR>");
Response.Write ("Server load: " + ServerProperties.ServerLoad + "<BR>");
Response.Write ("Total requests: " + ServerProperties.TotalRequests + "<BR>");
function ShowFileServerMetrics(ServerProperties)
Response.Write ("<HR><B>File Server Metrics</B><BR>");
Response.Write ("Active files: " + ServerProperties.ActiveFiles + "<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 ("<B>Active files</B><UL>");
for(k=1;k<=ServerProperties.ListActiveFiles.Count;k++)
Response.Write ("<LI>" + String(ServerProperties.ListActiveFiles.Item(k)));
Response.Write ("Maximum idle time: " + ServerProperties.MaxIdleTime + "<BR>");
Response.Write ("Root directory: " + ServerProperties.RootDirectory + "<BR>");
function ShowEventServerMetrics(ServerProperties)
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++)
Response.Write ("<LI>"+ServerProperties.ListFileMonitored.Item(k));
Next: Example.
Crystal Decisions, Inc. http://www.crystaldecisions.com Support services: http://support.crystaldecisions.com |