Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
Former Member

This document provides a way to get the central management server metrics using Business Intelligence platform Java SDK.

For more scripts and information on how to run these scripts refer to the blog avaiable here:

shawn.penner/blog/2013/06/04/scripts-and-samples

Below is the Java Server Pages (JSP) sample

Note:

•You would need to change the userName, password, cmsName  to the values specific to your enterprise server in the provided sample code.

• The sample code is tested with BI 4.0 version of SAP BusinessObjects Platform

Get CMS Server Metrics

<%@ page import="java.util.*" %>
<%@ page import="com.businessobjects.sdk.plugin.desktop.common.IMetric"%>
<%@ page import="com.businessobjects.sdk.plugin.desktop.common.IMetrics"%>
<%@ page import="com.crystaldecisions.sdk.framework.CrystalEnterprise"%>
<%@ page import="com.crystaldecisions.sdk.framework.IEnterpriseSession"%>
<%@ page import="com.crystaldecisions.sdk.framework.ISessionMgr"%>
<%@ page import="com.crystaldecisions.sdk.occa.infostore.IInfoObject"%>
<%@ page import="com.crystaldecisions.sdk.occa.infostore.IInfoObjects"%>
<%@ page import="com.crystaldecisions.sdk.occa.infostore.IInfoStore"%>
<%@ page import="com.crystaldecisions.sdk.plugin.desktop.server.*"%>
<html>

<head></head>

<body>

<table border="1" cellpadding="0" style="border-collapse: collapse" bordercolor="#111111" width="54%" id="AutoNumber1">

<tr>
<td width="71">Server Name</td>
<td width="71">Friendly Name</td>
<td width="71">Metric Name</td>
<td width="71">Metric Value</td></tr>

<%
  final String _userid = "AdminUser";  //use BO Enterprise User ID
  final String _password = "AdminPassword";         //fill in password
  final String _cms = "localhost:6400";
  final String _authentication = "secEnterprise";
 
 
 
   IInfoStore boInfoStore = null;
   IInfoObjects boInfoObjects = null;
    
  // SDKException failure = null;
   IEnterpriseSession eSession = null;
   IServer currentServer = null;
   IServerMetrics cmsAdmin = null;

  try {
   ISessionMgr mySessionMgr = CrystalEnterprise.getSessionMgr();
   eSession = mySessionMgr.logon(_userid, _password, _cms,_authentication );
  
     
  boInfoStore = (IInfoStore) eSession.getService("InfoStore");
  boInfoObjects = boInfoStore.query("Select * From CI_SYSTEMOBJECTS Where SI_PROGID='CrystalEnterprise.Server' and  SI_SERVER_DESCRIPTOR='APS'");
  currentServer = (IServer) boInfoObjects.get(0);
 
  out.println ("<tr><td>" + currentServer.getTitle()+"</td>");
        out.println ("<td>" + currentServer.getFriendlyName()+"</td>");
        cmsAdmin = (IServerMetrics)currentServer.getMetrics();
        IMetrics serverMetrics=(IMetrics)cmsAdmin.getMetrics("APSAdmin");
        for(int j=0;j<serverMetrics.size();j++)
        {
        IMetric serverMetric=(IMetric)serverMetrics.get(j);
        out.println ("<td>" + serverMetric.getName()+"</td>");
        out.println ("<td>" + serverMetric.getValue()+"</td></tr>");
  out.println ("<tr><td></td><td></td>");
        }
  } catch (Exception e) {
   
    out.println(e);
  
  }
  finally
  {
  if(eSession!=null)
  eSession.logoff();
  }
%>

1 Comment
Labels in this area