Creating and Editing Monitors
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
- Open a class and choose the method that will provide the monitor values.
- In the Outline view, from the method's context menu choose Create Monitor.
- In the wizard, specify the following monitor node properties:
- EAR project that references your project
- Monitor type
- Monitoring tree node. More information: Managing Monitors with the Monitor Browser
- Monitor path - the path to the monitor under the monitor node
- Monitor name
- Measurement unit of the monitor
- Choose Next.
- In the wizard, specify:
- Refresh time and time unit - how often the monitor will run.
- Thresholds on which the monitor will change the status
- Monitor description
- Choose Next.
- If the information provided in the overview window is correct, choose Finish.
Editing a Monitor
- From the context menu of the monitor-configuration.xml file, choose Open With → Monitor Editor.
- From the Monitor Tree, select the monitor you want to edit.
- 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
- From the context menu of the monitor-configuration.xml file select Open With → Monitor Editor.
- In the Monitor Tree, select a node or subnode.
- Choose Add Monitor.
- Choose a WAR file to which the EAR has reference.
- Choose an existing monitoring package and class from this package.
- Enter a name for the monitor.
- Choose Next.
- After selecting the monitor type, tree node, path, name and unit, choose Next.
- Specify the data collection properties.
- If the information provided in the overview window is correct, choose Finish.
Deleting a Monitor
- In the Monitor Tree, select the monitor you want to delete
- Choose Delete.
Result
After creating or adding a monitor, you need to build the application and deploy it.
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();
}
}
}