Class AbstractSampleManager
java.lang.Object
org.ametys.runtime.plugins.admin.jvmstatus.monitoring.sample.AbstractSampleManager
- All Implemented Interfaces:
PluginAware
,MonitoringConstants
,SampleManager
,Configurable
,LogEnabled
,ThreadSafe
- Direct Known Subclasses:
AbstractAlertSampleManager
,AbstractMemorySampleManager
,CacheSampleManager
,CPUSampleManager
,HttpRequestSampleManager
,HttpSessionSampleManager
,SessionSampleManager
,UptimeSampleManager
public abstract class AbstractSampleManager
extends Object
implements SampleManager, MonitoringConstants, ThreadSafe, LogEnabled, Configurable, PluginAware
AbstractSampleManager gives you the infrastructure for easily
deploying a
SampleManager
.-
Nested Class Summary
Nested classes/interfaces inherited from interface org.ametys.runtime.plugins.admin.jvmstatus.monitoring.MonitoringConstants
MonitoringConstants.Period
-
Field Summary
Modifier and TypeFieldDescriptionprotected I18nizableText
descriptionprotected String
The name of the feature that has declared this componentprotected String
idprotected I18nizableText
labelprotected Logger
Logger available to subclasses.protected String
The name of the plugin that has declared this componentFields inherited from interface org.ametys.runtime.plugins.admin.jvmstatus.monitoring.MonitoringConstants
FEEDING_PERIOD, RRD_EXT, RRD_STORAGE_DIRECTORY
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected abstract void
_configureDatasources
(org.rrd4j.core.RrdDef rrdDef) Provides the data sources.protected void
_configureValueRange
(org.rrd4j.graph.RrdGraphDef graphDef) Configure the value range to be displayed.
Default implementation set min value to0
.protected abstract String
Provide the graph title._internalCollect
(org.rrd4j.core.Sample sample) Collect data into the Round Robin Database.protected void
_registerDatasources
(org.rrd4j.core.RrdDef rrdDef, String dsName, org.rrd4j.DsType dsType, double minValue, double maxValue) Register a new data source where heartbeat property is set internally.protected void
_setCommonParameters
(org.rrd4j.graph.RrdGraphDef graphDef) Set common graph definition parameters (graph style, ...)collect
(org.rrd4j.core.Sample sample) Collect data into the Round Robin Database.void
configure
(Configuration configuration) void
configureRRDDef
(org.rrd4j.core.RrdDef rrdDef) Provides the definition to use for this RRD file.void
enableLogging
(Logger logger) Provides the human readable description.getId()
Provides the id of this manager.
Must be unique in the application.getLabel()
Provides the human readable name to use.void
setPluginInfo
(String pluginName, String featureName, String id) Sets the plugin info relative to the current component.
Note : The feature name may be null if the targeted component in declared at plugin level.
-
Field Details
-
_logger
Logger available to subclasses. -
_pluginName
The name of the plugin that has declared this component -
_featureName
The name of the feature that has declared this component -
_id
id -
_label
label -
_description
description
-
-
Constructor Details
-
AbstractSampleManager
public AbstractSampleManager()
-
-
Method Details
-
getId
Description copied from interface:SampleManager
Provides the id of this manager.
Must be unique in the application.- Specified by:
getId
in interfaceSampleManager
- Returns:
- the id.
-
getLabel
Description copied from interface:SampleManager
Provides the human readable name to use.- Specified by:
getLabel
in interfaceSampleManager
- Returns:
- the human readable name.
-
getDescription
Description copied from interface:SampleManager
Provides the human readable description.- Specified by:
getDescription
in interfaceSampleManager
- Returns:
- the human readable description.
-
configure
- Specified by:
configure
in interfaceConfigurable
- Throws:
ConfigurationException
-
setPluginInfo
Description copied from interface:PluginAware
Sets the plugin info relative to the current component.
Note : The feature name may be null if the targeted component in declared at plugin level.- Specified by:
setPluginInfo
in interfacePluginAware
- Parameters:
pluginName
- Unique identifier for the plugin hosting the extensionfeatureName
- Unique feature identifier (unique for a given pluginName)id
- Unique identifier of this component
-
enableLogging
- Specified by:
enableLogging
in interfaceLogEnabled
-
configureRRDDef
Description copied from interface:SampleManager
Provides the definition to use for this RRD file. Called only when the RRD file is about to be created.- Specified by:
configureRRDDef
in interfaceSampleManager
- Parameters:
rrdDef
- the Round Robin Database definition.
-
_configureDatasources
Provides the data sources.- Parameters:
rrdDef
- the Round Robin Database definition.
-
_registerDatasources
protected void _registerDatasources(org.rrd4j.core.RrdDef rrdDef, String dsName, org.rrd4j.DsType dsType, double minValue, double maxValue) Register a new data source where heartbeat property is set internally.- Parameters:
rrdDef
- the Round Robin Database definition.dsName
- the data source name.dsType
- the data source type.minValue
- the minimal acceptable value. UseDouble.NaN
if unknown.maxValue
- the maximal acceptable value. UseDouble.NaN
if unknown.
-
collect
Description copied from interface:SampleManager
Collect data into the Round Robin Database.- Specified by:
collect
in interfaceSampleManager
- Parameters:
sample
- the sample to collect.- Returns:
- The collected values for each datasource name.
- Throws:
IOException
- thrown in case of I/O error.
-
_internalCollect
protected abstract Map<String,Object> _internalCollect(org.rrd4j.core.Sample sample) throws IOException Collect data into the Round Robin Database.- Parameters:
sample
- the sample to collect.- Returns:
- The collected values for each datasource name.
- Throws:
IOException
- thrown in case of I/O error.
-
_setCommonParameters
Set common graph definition parameters (graph style, ...)- Parameters:
graphDef
- the prepared graph definition.
-
_configureValueRange
Configure the value range to be displayed.
Default implementation set min value to0
.- Parameters:
graphDef
- the graph definition.
-
_getGraphTitle
Provide the graph title.- Returns:
- the graph title.
-