org.rhq.core.domain.alert
Class AlertCondition

java.lang.Object
  extended by org.rhq.core.domain.alert.AlertCondition
All Implemented Interfaces:
Serializable

public class AlertCondition
extends Object
implements Serializable

An alert condition (e.g. ActiveThreads > 100) as configured in an alert definition.

See Also:
Serialized Form

Field Summary
static String QUERY_BY_CATEGORY_AVAILABILITY
           
static String QUERY_BY_CATEGORY_BASELINE
           
static String QUERY_BY_CATEGORY_CHANGE
           
static String QUERY_BY_CATEGORY_CONTROL
           
static String QUERY_BY_CATEGORY_COUNT_BASELINE
           
static String QUERY_BY_CATEGORY_COUNT_PARAMETERIZED
           
static String QUERY_BY_CATEGORY_DRIFT
           
static String QUERY_BY_CATEGORY_EVENT
           
static String QUERY_BY_CATEGORY_RANGE
           
static String QUERY_BY_CATEGORY_RESOURCE_CONFIG
           
static String QUERY_BY_CATEGORY_THRESHOLD
           
static String QUERY_BY_CATEGORY_TRAIT
           
static String QUERY_DELETE_BY_RESOURCES
           
static String QUERY_FIND_RESOURCE_STATUS_BY_CONDITION_ID
           
static String RECOVERY_CONDITIONAL_EXPRESSION
           
 
Constructor Summary
AlertCondition()
          Creates a new alert condition.
AlertCondition(AlertCondition cond)
          Creates a skeletal copy of the specified alert condition.
AlertCondition(AlertDefinition alertDef, AlertConditionCategory type)
           
 
Method Summary
 void addConditionLog(AlertConditionLog condLog)
           
 boolean equals(Object obj)
           
 AlertDefinition getAlertDefinition()
           
 AlertConditionCategory getCategory()
           
 String getComparator()
          THRESHOLD and BASELINE: one of these comparators: "<", ">" or "=" For calltime alert conditions (i.e. category CHANGE for calltime metric definitions), comparator will be one of these comparators: "HI", "LO", "CH" (where "CH" means "change").
 Set<AlertConditionLog> getConditionLogs()
           
 int getId()
           
 MeasurementDefinition getMeasurementDefinition()
          Identifies the measurement definition of the metric that is to be compared when determining if the condition is true.
 String getName()
          The name of the condition whose semantics are different based on this condition's category: AVAILABILITY: n/a (null) THRESHOLD: the name of the metric (TODO: today its the display name, very bad for i18n purposes) BASELINE: the name of the metric (TODO: today its the display name, very bad for i18n purposes) CHANGE: the name of the metric (TODO: today its the display name, very bad for i18n purposes) OR (for calltime alert conditions only) this will be the optional regular expression condition (which may be null) TRAIT: the name of the trait (TODO: today its the display name, very bad for i18n purposes) CONTROL: the name of the operation (not its display name) EVENT: the level of event to compare with (DEBUG, INFO, WARN, ERROR, FATAL) RESOURCE_CONFIG: n/a (null) DRIFT: the name of the drift definition that triggered the drift detection.
 String getOption()
          The option string is optional and its semantics differ based on the category of this condition: AVAILABILITY: the AvailabilityType to trigger off of (DOWN or UP) THRESHOLD: for calltime metric conditions, one of "MIN, "MAX", "AVG" - all others are n/a BASELINE: one of "min", "max" or "mean" - indicates what the threshold is compared to (min/max/avg baseline value) CHANGE: for calltime metric conditions, one of "MIN, "MAX", "AVG" - all others are n/a TRAIT: n/a CONTROL: the OperationRequestStatus name (SUCCESS, FAILURE, etc).
 Double getThreshold()
          Returns the threshold to compare a measurement value to see if the condition is true.
 Integer getTriggerId()
           
 int hashCode()
           
 void setAlertDefinition(AlertDefinition alertDef)
           
 void setCategory(AlertConditionCategory category)
           
 void setComparator(String comparator)
           
 void setMeasurementDefinition(MeasurementDefinition measurementDefinition)
           
 void setName(String name)
           
 void setOption(String option)
           
 void setThreshold(Double threshold)
           
 void setTriggerId(Integer triggerId)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

QUERY_DELETE_BY_RESOURCES

public static final String QUERY_DELETE_BY_RESOURCES
See Also:
Constant Field Values

QUERY_BY_CATEGORY_BASELINE

public static final String QUERY_BY_CATEGORY_BASELINE
See Also:
Constant Field Values

QUERY_BY_CATEGORY_CHANGE

public static final String QUERY_BY_CATEGORY_CHANGE
See Also:
Constant Field Values

QUERY_BY_CATEGORY_TRAIT

public static final String QUERY_BY_CATEGORY_TRAIT
See Also:
Constant Field Values

QUERY_BY_CATEGORY_AVAILABILITY

public static final String QUERY_BY_CATEGORY_AVAILABILITY
See Also:
Constant Field Values

QUERY_BY_CATEGORY_CONTROL

public static final String QUERY_BY_CATEGORY_CONTROL
See Also:
Constant Field Values

QUERY_BY_CATEGORY_THRESHOLD

public static final String QUERY_BY_CATEGORY_THRESHOLD
See Also:
Constant Field Values

QUERY_BY_CATEGORY_EVENT

public static final String QUERY_BY_CATEGORY_EVENT
See Also:
Constant Field Values

QUERY_BY_CATEGORY_RESOURCE_CONFIG

public static final String QUERY_BY_CATEGORY_RESOURCE_CONFIG
See Also:
Constant Field Values

QUERY_BY_CATEGORY_DRIFT

public static final String QUERY_BY_CATEGORY_DRIFT
See Also:
Constant Field Values

QUERY_BY_CATEGORY_RANGE

public static final String QUERY_BY_CATEGORY_RANGE
See Also:
Constant Field Values

QUERY_BY_CATEGORY_COUNT_BASELINE

public static final String QUERY_BY_CATEGORY_COUNT_BASELINE
See Also:
Constant Field Values

QUERY_BY_CATEGORY_COUNT_PARAMETERIZED

public static final String QUERY_BY_CATEGORY_COUNT_PARAMETERIZED
See Also:
Constant Field Values

QUERY_FIND_RESOURCE_STATUS_BY_CONDITION_ID

public static final String QUERY_FIND_RESOURCE_STATUS_BY_CONDITION_ID
See Also:
Constant Field Values

RECOVERY_CONDITIONAL_EXPRESSION

public static final String RECOVERY_CONDITIONAL_EXPRESSION
See Also:
Constant Field Values
Constructor Detail

AlertCondition

public AlertCondition()
Creates a new alert condition.


AlertCondition

public AlertCondition(AlertDefinition alertDef,
                      AlertConditionCategory type)

AlertCondition

public AlertCondition(AlertCondition cond)
Creates a skeletal copy of the specified alert condition.

Parameters:
cond - the alert condition to be copied
Method Detail

getId

public int getId()

getCategory

public AlertConditionCategory getCategory()

setCategory

public void setCategory(AlertConditionCategory category)

getMeasurementDefinition

public MeasurementDefinition getMeasurementDefinition()
Identifies the measurement definition of the metric that is to be compared when determining if the condition is true. This is null if the condition category is not a metric-related one (metric related categories are THRESHOLD, TRAIT, BASELINE and CHANGE; others are not).

Returns:
measurement definition or null

setMeasurementDefinition

public void setMeasurementDefinition(MeasurementDefinition measurementDefinition)

getName

public String getName()
The name of the condition whose semantics are different based on this condition's category: AVAILABILITY: n/a (null) THRESHOLD: the name of the metric (TODO: today its the display name, very bad for i18n purposes) BASELINE: the name of the metric (TODO: today its the display name, very bad for i18n purposes) CHANGE: the name of the metric (TODO: today its the display name, very bad for i18n purposes) OR (for calltime alert conditions only) this will be the optional regular expression condition (which may be null) TRAIT: the name of the trait (TODO: today its the display name, very bad for i18n purposes) CONTROL: the name of the operation (not its display name) EVENT: the level of event to compare with (DEBUG, INFO, WARN, ERROR, FATAL) RESOURCE_CONFIG: n/a (null) DRIFT: the name of the drift definition that triggered the drift detection. This is actually a regex that allows the user to match more than one drift definition if they so choose. (this value may be null, in which case it doesn't matter which drift definition were the ones in which the drift was detected) RANGE: the name of the metric (TODO: today its the display name, very bad for i18n purposes)

Returns:
additional information about the condition

setName

public void setName(String name)

getComparator

public String getComparator()
THRESHOLD and BASELINE: one of these comparators: "<", ">" or "=" For calltime alert conditions (i.e. category CHANGE for calltime metric definitions), comparator will be one of these comparators: "HI", "LO", "CH" (where "CH" means "change"). RANGE: one of these comparators "<", ">" (meaning inside and outside the range respectively) or one of these "<=", ">=" (meaning inside and outside inclusive respectively) Other types of conditions will return null (i.e. this will be null if the condition does not compare values).

Returns:
comparator string

setComparator

public void setComparator(String comparator)

getThreshold

public Double getThreshold()
Returns the threshold to compare a measurement value to see if the condition is true. This is only valid for conditions of category THRESHOLD, BASELINE, RANGE and CHANGE (but only where CHANGE is for a calltime metric alert condition). All other condition types will return null. Note: If RANGE condition, this threshold is always the LOW end of the range. The high end of the range is in getOption().

Returns:
threshold value or null

setThreshold

public void setThreshold(Double threshold)

getOption

public String getOption()
The option string is optional and its semantics differ based on the category of this condition: AVAILABILITY: the AvailabilityType to trigger off of (DOWN or UP) THRESHOLD: for calltime metric conditions, one of "MIN, "MAX", "AVG" - all others are n/a BASELINE: one of "min", "max" or "mean" - indicates what the threshold is compared to (min/max/avg baseline value) CHANGE: for calltime metric conditions, one of "MIN, "MAX", "AVG" - all others are n/a TRAIT: n/a CONTROL: the OperationRequestStatus name (SUCCESS, FAILURE, etc). EVENT: the regular expression of the message to match (which may be empty string if not specified) RESOURCE_CONFIG: n/a DRIFT: a regular expression to match files whose content drifted (may be empty string or null if not specified) RANGE: the string form of a double value that is the HIGH end of the range (low end is getThreshold())

Returns:
additional information about the condition

setOption

public void setOption(String option)

getTriggerId

public Integer getTriggerId()

setTriggerId

public void setTriggerId(Integer triggerId)

getAlertDefinition

public AlertDefinition getAlertDefinition()

setAlertDefinition

public void setAlertDefinition(AlertDefinition alertDef)

getConditionLogs

public Set<AlertConditionLog> getConditionLogs()

addConditionLog

public void addConditionLog(AlertConditionLog condLog)

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2008-2011 Red Hat, Inc.. All Rights Reserved.