Show TOC

 Creating and Editing MonitorsLocate this document in the navigation structure

Use

You can automatically generate a monitor-configuration.xml document through a graphical interface provided by SAP NetWeaver Developer Studio. This approach is faster and decreases the likelihood of errors compared to manually creating this XML file.

Prerequisites

The Java EE class that will provide the monitoring data is created.

Procedure

Creating a Monitor

  1. Open a class and choose the method that will provide the monitor values.
  2. In the Outline view, from the method's context menu choose Create Monitor.
    Note

    This method should return a value of type byte, char, integer, long, Boolean or string.

    The monitor type depends on the value returned by the method. More information: Types of Monitors and Their Usage

  3. In the wizard, specify the following monitor node properties:
    1. EAR project that references your project
    2. Monitor type
    3. Monitoring tree node. More information: Managing Monitors with the Monitor Browser
    4. Monitor path - the path to the monitor under the monitor node
    5. Monitor name
    6. Measurement unit of the monitor
  4. Choose Next.
  5. In the wizard, specify:
    1. Refresh time and time unit - how often the monitor will run.
    2. Thresholds on which the monitor will change the status
    3. Monitor description
  6. Choose Next.
  7. If the information provided in the overview window is correct, choose Finish.

Editing a Monitor

  1. From the context menu of the monitor-configuration.xml file, choose Open With → Monitor Editor.
  2. From the Monitor Tree, select the monitor you want to edit.
  3. In the Properties node of the Monitor Editor you can edit the monitor name and unit, configuration group name, data collection properties, monitor thresholds and the monitor description.

Adding a Monitor

  1. From the context menu of the monitor-configuration.xml file select Open With → Monitor Editor.
  2. In the Monitor Tree, select a node or subnode.
  3. Choose Add Monitor.
  4. Choose a WAR file to which the EAR has reference.
  5. Choose an existing monitoring package and class from this package.
  6. Enter a name for the monitor.
  7. Choose Next.
  8. After selecting the monitor type, tree node, path, name and unit, choose Next.
  9. Specify the data collection properties.
  10. If the information provided in the overview window is correct, choose Finish.

Deleting a Monitor

  1. In the Monitor Tree, select the monitor you want to delete
  2. Choose Delete.
    Note

    You can also delete subnodes in the monitor tree by choosing Delete Node in the Monitor Tree.

Result

After creating or adding a monitor, you need to build the application and deploy it.

Tip

Following the monitor creation, you have to add one class that will call the registerMonitorMBean() method from the class that you selected at the beginning.

 

importjavax.servlet.ServletException;
 
/**
 * Servlet implementation class for Servlet: RunningServlet
 *
 */
 public class TestServlet extends javax.servlet.http.HttpServlet implements javax.servlet.Servlet {
    /**
    *
    */
   private static final long serialVersionUID = 4963419095244286716L;
   /* (non-Java-doc)
    * @see javax.servlet.http.HttpServlet#HttpServlet()
    */
    
   public TestServlet() {
      super();
   }    
  
   /* (non-Javadoc)
    * @see javax.servlet.GenericServlet#init()
    */
  
  
   public void init() throws ServletException {
      super.init();
      try {      
         new Test().registerMonitorMBean();
 
      // Test is your selected class     
      } catch (Exception e) {
         // TODO Auto-generated catch block
         e.printStackTrace();
      }    
   }
}