Multiple components monitoring

You can filter the components that you want to monitor by using the monitor-1.0 feature in Liberty. The components to be filtered must be configured in the server.xml file.

  1. To specify the components that you want to filter, add the following code to the server.xml file.
    <server description="new server">
    
         <featureManager>
         <feature>jsp-2.2</feature>		
         <feature>jdbc-4.0</feature>		
         <feature>monitor-1.0</feature>	 
    	
         <monitor  filter="JVM,ThreadPool,WebContainer,Session,ConnectionPool"/>
    </server>	

    By default, if the filters are not provided in the <monitor> tag, all the components that are currently monitored as part of the monitor-1.0 feature are monitored. You can specify the components that you want to monitor by providing the group name as part of the filter.

    For example: If you want to monitor only the JVM and WebContainer components, specify the components in the server.xml file as follows:
    <monitor filter="JVM,WebContainer"/>
    Important: You cannot filter JAX-WS counters as you do for the rest of the monitor-1.0 modules. JAX-WS metrics are implemented differently than the rest of the metrics and have no filter option.
  2. To remove components from monitoring.

    To stop monitoring a component, you must remove the component from the filter group at run time.

    For example: The following filter configuration monitors the JVM, ThreadPool, WebContainer, Session and ConnectionPool components:
    <monitor  filter="JVM,ThreadPool,WebContainer,Session,ConnectionPool"/>
    To stop monitoring the components WebContainer and Session, remove those components from the filter configuration:
    <monitor filter="JVM,ThreadPool,ConnectionPool" />
  3. To enable monitoring of components at run time.

    If you want to enable monitoring for specific components at run time, you can specify the components in the monitor tag at run time.

    The data that is collected by the filtering components is available as MXBeans.
    Note: Currently, fine-grained monitoring is supported only at the component level (such as WebContainer, ThreadPool, JVM) and not at the counter level.