Package kieker.monitoring.probe.servlet
Class SystemResourceUsageServletContextListener
java.lang.Object
kieker.monitoring.probe.servlet.AbstractRegularSamplingServletContextListener
kieker.monitoring.probe.servlet.SystemResourceUsageServletContextListener
- All Implemented Interfaces:
java.util.EventListener
,javax.servlet.ServletContextListener
public class SystemResourceUsageServletContextListener extends AbstractRegularSamplingServletContextListener
Starts and stops the periodic logging of various system resource samplers
provided by the OshiSamplerFactory
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.
Note that the set of included samplers will be extended with new samplers
becoming available in the OshiSamplerFactory
.
The integration and configuration in a web.xml file works as follows:
<web-app>
...
<context-param>
<param-name>SystemResourceUsageServletContextListener.samplingIntervalSeconds</param-name>
<param-value>15</param-value>
</context-param>
<context-param>
<param-name>SystemResourceUsageServletContextListener.initialSamplingDelaySeconds</param-name>
<param-value>0</param-value>
</context-param>
<listener>
<listener-class>
kieker.monitoring.probe.servlet.SystemResourceUsageServletContextListener
</listener-class>
</listener>
...
</web-app>
}
- Since:
- 1.12
- Author:
- Andre van Hoorn
-
Field Summary
Fields Modifier and Type Field Description 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
Constructors Constructor Description SystemResourceUsageServletContextListener()
Empty constructor. -
Method Summary
Modifier and Type Method Description 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
-
Field Details
-
CONTEXT_PARAM_NAME_SAMPLING_INTERVAL_SECONDS
public static final java.lang.String CONTEXT_PARAM_NAME_SAMPLING_INTERVAL_SECONDSParameter 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_SECONDSParameter name for the initial delay to be used in the web.xml file.
-
-
Constructor Details
-
SystemResourceUsageServletContextListener
public SystemResourceUsageServletContextListener()Empty constructor.
-
-
Method Details
-
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 classAbstractRegularSamplingServletContextListener
- 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 classAbstractRegularSamplingServletContextListener
- Returns:
- the parameter name
-
createSamplers
Description copied from class:AbstractRegularSamplingServletContextListener
Create samplers for the specific sampling class.- Specified by:
createSamplers
in classAbstractRegularSamplingServletContextListener
- Returns:
- array of samplers
-