Kieker 1.11

kieker.monitoring.probe.servlet
Class CPUMemUsageServletContextListener

java.lang.Object
  extended by kieker.monitoring.probe.servlet.AbstractRegularSamplingServletContextListener
      extended by kieker.monitoring.probe.servlet.CPUMemUsageServletContextListener
All Implemented Interfaces:
java.util.EventListener, javax.servlet.ServletContextListener

public class CPUMemUsageServletContextListener
extends AbstractRegularSamplingServletContextListener

Starts and stops the periodic logging of CPU utilization and Memory usage employing the SigarSamplerFactory as the Servlet is initialized and destroyed respectively.
The initial delay and the sampling period (both given in seconds) can be configured via context-params in the web.xml file, as shown below.

The integration and configuration in a web.xml file works as follows:

  <web-app>
  ...
  
  <context-param>
   <param-name>CPUMemUsageServletContextListener.samplingIntervalSeconds</param-name>
   <param-value>15</param-value>
  </context-param>
  
  <context-param>
   <param-name>CPUMemUsageServletContextListener.initialSamplingDelaySeconds</param-name>
   <param-value>0</param-value>
  </context-param>
  
  <listener>
    <listener-class>
     kieker.monitoring.probe.servlet.CPUMemUsageServletContextListener
    </listener-class>
  </listener>
 
 ... 
 </web-app>
 }
 

Since:
1.3
Author:
Andre van Hoorn

Field Summary
static java.lang.String CONTEXT_PARAM_NAME_INITIAL_SAMPLING_DELAY_SECONDS
          Parameter name for the initial delay to be used in the web.xml file.
static java.lang.String CONTEXT_PARAM_NAME_SAMPLING_INTERVAL_SECONDS
          Parameter name for the sampling interval to be used in the web.xml file.
 
Fields inherited from class kieker.monitoring.probe.servlet.AbstractRegularSamplingServletContextListener
DEFAULT_SENSOR_INITIAL_DELAY_SECONDS, DEFAULT_SENSOR_INTERVAL_SECONDS
 
Constructor Summary
CPUMemUsageServletContextListener()
          Empty constructor.
 
Method Summary
protected  ISampler[] createSamplers()
          Create samplers for the specific sampling class.
protected  java.lang.String getContextParameterNameSamplingDelaySeconds()
          Parameter name for the sampling delay to be used in the web.xml file.
protected  java.lang.String getContextParameterNameSamplingIntervalSeconds()
          Parameter name for the sampling interval to be used in the web.xml file.
 
Methods inherited from class kieker.monitoring.probe.servlet.AbstractRegularSamplingServletContextListener
contextDestroyed, contextInitialized
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONTEXT_PARAM_NAME_SAMPLING_INTERVAL_SECONDS

public static final java.lang.String CONTEXT_PARAM_NAME_SAMPLING_INTERVAL_SECONDS
Parameter name for the sampling interval to be used in the web.xml file.


CONTEXT_PARAM_NAME_INITIAL_SAMPLING_DELAY_SECONDS

public static final java.lang.String CONTEXT_PARAM_NAME_INITIAL_SAMPLING_DELAY_SECONDS
Parameter name for the initial delay to be used in the web.xml file.

Constructor Detail

CPUMemUsageServletContextListener

public CPUMemUsageServletContextListener()
Empty constructor.

Method Detail

getContextParameterNameSamplingIntervalSeconds

protected java.lang.String getContextParameterNameSamplingIntervalSeconds()
Description copied from class: AbstractRegularSamplingServletContextListener
Parameter name for the sampling interval to be used in the web.xml file.

Specified by:
getContextParameterNameSamplingIntervalSeconds in class AbstractRegularSamplingServletContextListener
Returns:
the parameter name

getContextParameterNameSamplingDelaySeconds

protected java.lang.String getContextParameterNameSamplingDelaySeconds()
Description copied from class: AbstractRegularSamplingServletContextListener
Parameter name for the sampling delay to be used in the web.xml file.

Specified by:
getContextParameterNameSamplingDelaySeconds in class AbstractRegularSamplingServletContextListener
Returns:
the parameter name

createSamplers

protected ISampler[] createSamplers()
Description copied from class: AbstractRegularSamplingServletContextListener
Create samplers for the specific sampling class.

Specified by:
createSamplers in class AbstractRegularSamplingServletContextListener
Returns:
array of samplers

Kieker 1.11

Copyright 2015 Kieker Project, http://kieker-monitoring.net