Class ThresholdEntity

  • All Implemented Interfaces:
    Cloneable

    public final class ThresholdEntity
    extends Object
    implements Cloneable
    Wraps the XML created org.opennms.netmgt.config.threshd.Threshold class and provides the ability to track threshold exceeded occurrences.
    Version:
    $Id: $
    Author:
    ranger
    • Constructor Detail

      • ThresholdEntity

        public ThresholdEntity​(EntityScopeProvider entityScopeProvider)
        Constructor.
    • Method Detail

      • getDataSourceExpression

        public String getDataSourceExpression()
        Get datasource name
        Returns:
        a String object.
      • getDatasourceType

        public String getDatasourceType()
        Get datasource type
        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 class Object
        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.
        Overrides:
        toString in class Object
        Returns:
        String which represents the content of this ThresholdEntity
      • 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 events
        resource - a CollectionResourceWrapper object.
        Returns:
        List of events
      • 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 - a ThresholdEntity 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.