Entering content frame

Procedure documentation Putting it All Together Locate the document in its SAP Library structure

Use

This section summarizes the steps and the code for instrumenting an application with monitoring.

Procedure

...

       1.      In the monitoring XML file, describe the monitoring tree nodes to be installed:

             ….

<text-monitor name="Bank name" configuration-group="Name">

    <monitored-resource name="BankMBean" type="APPLICATION"/>

    <text-attribute-mapping>

        <text-attribute>

            <observed-resource-attribute name="BankName"/>

        </text-attribute>

    </text-attribute-mapping>

</text-monitor>

 

       2.      In the web.xml, declare a security role and let the Servlet run with this role:

<servlet>

   <servlet-name></servlet-name>

   <servlet-class></servlet-class>

   <run-as>

      <role-name>MBeanCreator</role-name>

   </run-as>

</servlet>

     

 

     

<security-role>

   <description>Role for accessing MBean server</description>

   <role-name>MBeanCreator</role-name>

</security-role>

 

       3.      In the web-j2ee-engine.xml, map the security role declared in the web.xml to the administrators group in the J2EE Engine:

<web-j2ee-engine>

    <security-role-map>

      <role-name>

        MBeanCreator

      </role-name>

      <server-role-name>

        administrators

      </server-role-name>

    </security-role-map>

</web-j2ee-engine>

 

       4.      In the init() method of the Servlet, put the following coding:

InitialContext initialCtx = new InitialContext();

MBeanServer mbs = (MBeanServer) initialCtx.lookup("jmx");

ObjectName monitoringObjectName = ObjectNameFactory.getNameForApplicationResourcePerNode("BankMBean", RuntimeProperties.get(RuntimeProperties.PROPERTY_APPLICATION), ObjectNameFactory.EMPTY_VALUE, ObjectNameFactory.EMPTY_VALUE);

mbs.registerMBean(mBeanObject, monitoringObjectName);

 

 

Leaving content frame