Package org.opennms.netmgt.threshd
Class ThresholdEntity
- java.lang.Object
-
- org.opennms.netmgt.threshd.ThresholdEntity
-
-
Constructor Summary
Constructors Constructor Description ThresholdEntity(EntityScopeProvider entityScopeProvider)
Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addThreshold(BaseThresholdDefConfigWrapper threshold, ThresholdingSession thresholdingSession)
addThresholdThresholdEntity
clone()
Returns a copy of this ThresholdEntity object.void
delete()
Delete this will check states and will send rearm for all triggered.List<Event>
evaluateAndCreateEvents(Map<String,Double> values, Date date)
Evaluates the threshold in light of the provided datasource value and create any events for thresholds.List<Event>
evaluateAndCreateEvents(CollectionResourceWrapper resource, Map<String,Double> values, Date date)
Evaluates the threshold in light of the provided datasource value, for the named instance (or the generic instance if instance is null) and create any events for thresholds.String
getDataSourceExpression()
Get datasource nameString
getDatasourceLabel()
Get datasource LabelString
getDatasourceType()
Get datasource typeCollection<String>
getRequiredDatasources()
Returns the names of the dataousrces required to evaluate this threshold entityBaseThresholdDefConfigWrapper
getThresholdConfig()
getThresholdConfigstatic List<ThresholdEvaluator>
getThresholdEvaluators()
getThresholdEvaluatorsList<ThresholdEvaluatorState>
getThresholdEvaluatorStates(String instance)
Returns the evaluator states *for the given instance.void
merge(ThresholdEntity entity)
Merges the configuration and update states using parameter entity as a reference.void
setEventProxy(ThresholdingEventProxy eventProxy)
String
toString()
This method is responsible for returning a String object which represents the content of this ThresholdEntity.
-
-
-
Constructor Detail
-
ThresholdEntity
public ThresholdEntity(EntityScopeProvider entityScopeProvider)
Constructor.
-
-
Method Detail
-
getThresholdConfig
public BaseThresholdDefConfigWrapper getThresholdConfig()
getThresholdConfig
- Returns:
- a
BaseThresholdDefConfigWrapper
object.
-
getDataSourceExpression
public String getDataSourceExpression()
Get datasource name- Returns:
- a
String
object.
-
getDatasourceLabel
public String getDatasourceLabel()
Get datasource Label- Returns:
- a
String
object.
-
getRequiredDatasources
public Collection<String> getRequiredDatasources()
Returns the names of the dataousrces required to evaluate this threshold entity- Returns:
- Collection of the names of datasources
-
clone
public ThresholdEntity clone()
Returns a copy of this ThresholdEntity object. NOTE: The m_lowThreshold and m_highThreshold member variables are not actually cloned...the returned ThresholdEntity object will simply contain references to the same Threshold objects as the original ThresholdEntity object. All state will be lost, particularly instances, so it's not a true clone by any stretch of the imagination- Overrides:
clone
in classObject
- Returns:
- a
ThresholdEntity
object.
-
toString
public String toString()
This method is responsible for returning a String object which represents the content of this ThresholdEntity. Primarily used for debugging purposes.
-
evaluateAndCreateEvents
public List<Event> evaluateAndCreateEvents(Map<String,Double> values, Date date)
Evaluates the threshold in light of the provided datasource value and create any events for thresholds. Semi-deprecated method; only used for old Thresholding code (threshd and friends) Implemented in terms of the other method with the same name and the extra param- Parameters:
values
- map of values (by datasource name) to evaluate against the threshold (might be an expression)date
- Date to use in created events- Returns:
- List of events
-
evaluateAndCreateEvents
public List<Event> evaluateAndCreateEvents(CollectionResourceWrapper resource, Map<String,Double> values, Date date)
Evaluates the threshold in light of the provided datasource value, for the named instance (or the generic instance if instance is null) and create any events for thresholds.- Parameters:
values
- map of values (by datasource name) to evaluate against the threshold (might be an expression)date
- Date to use in created eventsresource
- aCollectionResourceWrapper
object.- Returns:
- List of events
-
addThreshold
public void addThreshold(BaseThresholdDefConfigWrapper threshold, ThresholdingSession thresholdingSession)
addThreshold
- Parameters:
threshold
- aBaseThresholdDefConfigWrapper
object.
-
getThresholdEvaluatorStates
public List<ThresholdEvaluatorState> getThresholdEvaluatorStates(String instance)
Returns the evaluator states *for the given instance.- Parameters:
instance
- The key to use to identify the instance to get states for. Can be null to get the default instance- Returns:
- a
List
object.
-
merge
public void merge(ThresholdEntity entity)
Merges the configuration and update states using parameter entity as a reference.- Parameters:
entity
- aThresholdEntity
object.
-
delete
public void delete()
Delete this will check states and will send rearm for all triggered.
-
getThresholdEvaluators
public static final List<ThresholdEvaluator> getThresholdEvaluators()
getThresholdEvaluators
- Returns:
- a
List
object.
-
setEventProxy
public void setEventProxy(ThresholdingEventProxy eventProxy)
-
-