This document provides a way to get the web intelligence 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:

http://scn.sap.com/people/shawn.penner/blog/2013/06/04/scripts-and-samples

Below is the Java Server Pages (JSP) sample

Notes:

•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

<%@ 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="2" cellpadding="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber1">
<tr>
<th width="30%">Server Name</th>
<th width="40%">Metric Name</th>
<th width="30%">Metric Value</th>
<%
   final String _userid = "administrator";  //use BO Enterprise User ID
   final String _password = "Password1";         //fill in password
   final String _cms = "localhost:6400";
   final String _authentication = "secEnterprise";
  
   IInfoStore boInfoStore = null;
   IInfoObjects boInfoObjects = null;
   IEnterpriseSession eSession = null;
   IServer currentServer = null;
   IServerMetrics webiAdmin = 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_NAME='BIPW08R2.WebIntelligenceProcessingServer'");
  currentServer = (IServer) boInfoObjects.get(0);
 
  out.println ("<tr><td>" + currentServer.getTitle()+"</td>");
        webiAdmin = (IServerMetrics)currentServer.getMetrics();
        IMetrics serverMetrics=(IMetrics)webiAdmin.getMetrics("WebiServerAdmin");
        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>");
        }
  }
  catch (Exception e)
  {
  out.println(e);
  }
  finally
  {
  if(eSession != null)
  eSession.logoff();
  }
%>
</table>
</body>
</html>
To report this post you need to login first.

4 Comments

You must be Logged on to comment or reply to a post.

  1. Arun Kumar

    I am getting this error com.businessobjects.sdk.plugin.desktop.common.IMetrics.size() of a null object loaded from local variable ‘serverMetrics’.

    BO version is 4.1. Any idea what’s happening here?

    (0) 
    1. Prithviraj Shekhawat Post author

      Not sure if you still looking for a solution. Was not following forums for sometime now as was occupied.

      I have not tested this code on BI 4.1, and I do not have an env currently, however from the error message it seems the line below returns null object.

      IMetrics serverMetrics=(IMetrics)webiAdmin.getMetrics(“WebiServerAdmin”);


      Use the below code so that we may check if the service name in BI 4.1 has changed by any means.


      ====================================


      <%@ 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.*”%> 

      <% 

         final String _userid = “administrator”;  //use BO Enterprise User ID  

         final String _password = “password”;         //fill in password 

         final String _cms = “localhost:6400”; 

         final String _authentication = “secEnterprise”; 

          

         IInfoStore boInfoStore = null; 

         IInfoObjects boInfoObjects = null; 

         IEnterpriseSession eSession = null; 

         IServer currentServer = null;  

         IServerMetrics webiAdmin = 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_NAME=’HOSTNAME.WebIntelligenceProcessingServer'”); 

        currentServer = (IServer) boInfoObjects.get(0); 

         

        out.println (“<tr><td>” + currentServer.getTitle()+”</td>”); 

        webiAdmin = (IServerMetrics)currentServer.getMetrics();

        Set name=webiAdmin.getServiceInterfaceNames();

        Iterator it=name.iterator();

        while(it.hasNext())

        {

         out.println(“<BR><B>Service Interface Name : </B>”+it.next());

        }

        }  

        catch (Exception e)  

        { 

        out.println(e); 

        } 

        finally 

        { 

        if(eSession != null) 

        eSession.logoff(); 

        } 

      %> 

      </table> 

      </body> 

      </html>


      ====================================


      Let me know if the service interface name is other than “WebiServerAdmin“.


      Thanks,

      Prithvi

      (0) 
      1. Arun Kumar

        Thanks Prithvi. When i try with Webintelligenceprocessingserver the metrics doesn’t show any value just blank. I changed WebIntelligenceProcessingServer to AdaptiveProcesssingServer still the output doesn’t have any metrics value but it shows four service interface names –

        Service Interface Name : PJSAdmin

        Service Interface Name : ISGeneralAdmin

        Service Interface Name : AnalysisApplicationDesignService

        (0) 

Leave a Reply