@Entity public class AlertDefinitionEntity extends Object
AlertDefinitionEntity
class is used to model an alert that needs
to run in the system. Each received alert from an agent will essentially be
an instance of this template.Constructor and Description |
---|
AlertDefinitionEntity()
Constructor.
|
Modifier and Type | Method and Description |
---|---|
protected void |
addAlertGroup(AlertGroupEntity alertGroup)
Adds the specified alert group to the groups that this definition is
associated with.
|
boolean |
equals(Object object)
Gets the equality to another historical alert entry based on the following criteria:
definitionId
clusterId
definitionName
However, since we're guaranteed that definitionId is unique among persisted entities, we
can return the hashCode based on this value if it is set. |
Set<AlertGroupEntity> |
getAlertGroups()
Gets the alert groups that this alert definition is associated with.
|
ClusterEntity |
getCluster()
Gets the cluster that this alert definition is a member of.
|
Long |
getClusterId()
Gets the ID of the cluster that this alert definition is created for.
|
String |
getComponentName()
Gets the component name that this alert is associated with, if any.
|
Long |
getDefinitionId()
Gets the unique identifier for this alert definition.
|
String |
getDefinitionName()
Gets the name of this alert definition.
|
String |
getDescription()
Gets the optional description for this alert definition.
|
boolean |
getEnabled()
Gets whether this alert definition is enabled.
|
String |
getHash()
Gets the unique hash for the current state of this definition.
|
String |
getHelpURL()
Gets the help url for this alert.
|
String |
getLabel()
Gets the label for this alert definition.
|
int |
getRepeatTolerance()
Gets the number of sequential instances of an non-OK
AlertState
must be received in order to consider the alert instance as truly being in
that AlertState . |
Integer |
getScheduleInterval()
Gets the alert trigger interval, in seconds.
|
Scope |
getScope()
Gets the scope of the alert definition.
|
String |
getServiceName()
Gets the name of the service that this alert definition is associated with.
|
String |
getSource()
Gets the source that defines the type of alert and the alert properties.
|
SourceType |
getSourceType() |
int |
hashCode()
Gets a hash to uniquely identify this alert definition.
|
boolean |
isHostIgnored()
Gets whether this alert definition will ignore the hosts reporting the
alert and combine them all into a single alert entry.
|
boolean |
isRepeatToleranceEnabled()
Gets whether this definition overrides the default global tolerance value
specified in
cluster-env/alerts.repeat.tolerance . |
void |
preRemove()
Called before
EntityManager.remove(Object) for this entity, removes
the non-owning relationship between definitions and groups. |
protected void |
removeAlertGroup(AlertGroupEntity alertGroup)
Removes the specified alert group to the groups that this definition is
associated with.
|
void |
setAlertGroups(Set<AlertGroupEntity> alertGroups)
Sets the alert groups that this alert definition is associated with.
|
void |
setCluster(ClusterEntity clusterEntity)
Sets the cluster that the alert definition is a member of.
|
void |
setClusterId(Long clusterId)
Sets the ID of the cluster that this alert definition is created for.
|
void |
setComponentName(String componentName)
Sets the component name that this alert is associated with, if any.
|
void |
setDefinitionId(Long definitionId)
Sets the unique identifier for this alert definition.
|
void |
setDefinitionName(String definitionName)
Sets the name of this alert definition.
|
void |
setDescription(String description)
Gets the optional description for this alert definition.
|
void |
setEnabled(boolean enabled)
Sets whether this alert definition is enabled.
|
void |
setHash(String hash)
Gets the unique hash for the current state of this definition.
|
void |
setHelpURL(String helpURL)
Sets a help url for this alert.
|
void |
setHostIgnored(boolean ignoreHost)
Sets whether this alert definition will ignore the hosts reporting the
alert and combine them all into a single alert entry.
|
void |
setLabel(String label)
Sets a human readable label for this alert definition.
|
void |
setRepeatTolerance(int repeatTolerance)
Sets the number of sequential instances of an non-OK
AlertState
must be received in order to consider the alert instance as truly being in
that AlertState . |
void |
setRepeatToleranceEnabled(boolean enabled)
Sets whether this definition overrides the default global tolerance value
specified in
cluster-env/alerts.repeat.tolerance . |
void |
setScheduleInterval(Integer scheduleInterval)
Sets the alert trigger interval, in seconds.
|
void |
setScope(Scope scope)
Sets the scope of the alert definition.
|
void |
setServiceName(String serviceName)
Gets the name of the service that this alert definition is associated with.
|
void |
setSource(String alertSource)
Sets the source of the alert, typically in JSON, that defines the type of
the alert and its properties.
|
void |
setSourceType(SourceType sourceType) |
String |
toString() |
public Long getDefinitionId()
public void setDefinitionId(Long definitionId)
definitionId
- the ID (not null
).public String getSource()
null
).public void setSource(String alertSource)
alertSource
- the alert source (not null
).public Long getClusterId()
null
).public void setClusterId(Long clusterId)
clusterId
- the ID of the cluster (not null
).public ClusterEntity getCluster()
public void setCluster(ClusterEntity clusterEntity)
clusterEntity
- public String getComponentName()
null
if none.public void setComponentName(String componentName)
componentName
- the component name or null
if none.public Scope getScope()
Scope.SERVICE
or Scope.HOST
.null
if not defined.public void setScope(Scope scope)
Scope.SERVICE
or Scope.HOST
.scope
- the scope to set, or null
for none.public String getDefinitionName()
null
).public void setDefinitionName(String definitionName)
definitionName
- the name of the alert definition (not null
).public boolean getEnabled()
true
if this alert definition is enabled, false
otherwise.public void setEnabled(boolean enabled)
enabled
- true
if this alert definition is enabled, false
otherwise.public boolean isHostIgnored()
true
if this alert definition is to ignore hosts and
combine all alert instances into a single entry, false
otherwise.public void setHostIgnored(boolean ignoreHost)
ignoreHost
- true
if this alert definition is to ignore hosts and
combine all alert instances into a single entry, false
otherwise.public String getHash()
null
if there is none.public void setHash(String hash)
hash
- the unique hash to set or null
for none.public Integer getScheduleInterval()
public void setScheduleInterval(Integer scheduleInterval)
scheduleInterval
- the interval, in seconds.public String getServiceName()
null
).public void setServiceName(String serviceName)
serviceName
- the name of the service (not null
).public SourceType getSourceType()
public void setSourceType(SourceType sourceType)
sourceType
- public Set<AlertGroupEntity> getAlertGroups()
null
if none.public void setAlertGroups(Set<AlertGroupEntity> alertGroups)
alertGroups
- the groups, or null
for none.public void setLabel(String label)
label
- the label or null
if none.public String getLabel()
null
if none.public String getHelpURL()
null
if none.public void setHelpURL(String helpURL)
helpURL
- the helpURL or null
if none.public String getDescription()
null
if none.public void setDescription(String description)
description
- the description to set or null
for none.public int getRepeatTolerance()
AlertState
must be received in order to consider the alert instance as truly being in
that AlertState
.
A value of 1 or less indicates that there is no tolerance and a single
alert will cause dispatching of alert notifications.public void setRepeatTolerance(int repeatTolerance)
AlertState
must be received in order to consider the alert instance as truly being in
that AlertState
.
A value of 1 or less indicates that there is no tolerance and a single
alert will cause dispatching of alert notifications.repeatTolerance
- the tolerance to setpublic boolean isRepeatToleranceEnabled()
cluster-env/alerts.repeat.tolerance
. If enabled, the
value from getRepeatTolerance()
should be used to calculate retry
tolerance.true
to override the global
value.public void setRepeatToleranceEnabled(boolean enabled)
cluster-env/alerts.repeat.tolerance
. If enabled, the
value from getRepeatTolerance()
should be used to calculate retry
tolerance.enabled
- true
to override the defautlt value and use the value
returned from getRepeatTolerance()
.protected void addAlertGroup(AlertGroupEntity alertGroup)
alertGroup
- protected void removeAlertGroup(AlertGroupEntity alertGroup)
alertGroup
- public void preRemove()
EntityManager.remove(Object)
for this entity, removes
the non-owning relationship between definitions and groups.public boolean equals(Object object)
definitionId
is unique among persisted entities, we
can return the hashCode based on this value if it is set.
public int hashCode()
definitionId
is unique among persisted entities,
we can return the hashCode based on this value if it is set.
Copyright © 2022 Apache Software Foundation. All rights reserved.