public class AlertDefinition extends Object
AlertDefinition
class represents all of the necessary information
to schedule, run, and collect alerts.
Although all members of this class must define a complex equals
and
hashCode
method, this class itself does not. Instead,
equals(Object)
is defined as a name comparison only since name is
unique to a definition. This allows us to easily insert instances of this
class into a HashSet
if necessary.
When making comparisons for equality for things like stack/database merging,
use deeplyEquals(Object)
.Constructor and Description |
---|
AlertDefinition() |
Modifier and Type | Method and Description |
---|---|
Alert |
buildAlert(double value,
List<Object> args)
Map the incoming value to
AlertState and generate an alert with that state. |
boolean |
deeplyEquals(Object obj)
Compares
equals(Object) of every field. |
boolean |
equals(Object obj)
Gets equality based on name only.
|
long |
getClusterId()
Gets the cluster ID for this definition.
|
String |
getComponentName() |
long |
getDefinitionId() |
String |
getDescription() |
String |
getHelpURL() |
int |
getInterval() |
String |
getLabel() |
String |
getName() |
int |
getRepeatTolerance() |
Boolean |
getRepeatToleranceEnabled() |
Scope |
getScope() |
String |
getServiceName() |
Source |
getSource() |
String |
getUuid()
Gets the UUID of the definition.
|
int |
hashCode()
Gets a hash based on name only.
|
boolean |
isEnabled() |
boolean |
isHostIgnored() |
Set<String> |
matchingHosts(Clusters clusters)
Collect the host names from the cluster where the given alert is allowed to run.
|
void |
setClusterId(long clusterId)
Sets the cluster ID for this definition.
|
void |
setComponentName(String name) |
void |
setDefinitionId(long definitionId) |
void |
setDescription(String description) |
void |
setEnabled(boolean definitionEnabled) |
void |
setHelpURL(String helpURL)
Sets the help url for this definition.
|
void |
setHostIgnored(boolean definitionHostIgnored) |
void |
setInterval(int definitionInterval) |
void |
setLabel(String definitionLabel)
Sets the label for this definition.
|
void |
setName(String definitionName) |
void |
setRepeatTolerance(int repeatTolerance) |
void |
setRepeatToleranceEnabled(Boolean repeatToleranceEnabled) |
void |
setScope(Scope definitionScope) |
void |
setServiceName(String name) |
void |
setSource(Source definitionSource) |
void |
setUuid(String definitionUuid)
Sets the UUID of the definition
|
String |
toString() |
public long getClusterId()
public void setClusterId(long clusterId)
clusterId
- public long getDefinitionId()
public void setDefinitionId(long definitionId)
definitionId
- the definitionId to setpublic String getServiceName()
public void setServiceName(String name)
name
- the service namepublic String getComponentName()
public void setComponentName(String name)
name
- the component namepublic String getName()
public void setName(String definitionName)
definitionName
- the definition name.public Scope getScope()
public void setScope(Scope definitionScope)
public int getInterval()
public void setInterval(int definitionInterval)
public boolean isEnabled()
true
if enabledpublic void setEnabled(boolean definitionEnabled)
public boolean isHostIgnored()
true
if the host is ignored.public void setHostIgnored(boolean definitionHostIgnored)
public Source getSource()
public void setSource(Source definitionSource)
public String getLabel()
null
if none.public void setLabel(String definitionLabel)
definitionLabel
- public String getHelpURL()
null
if none.public void setHelpURL(String helpURL)
helpURL
- public String getDescription()
public void setDescription(String description)
description
- the description to setpublic void setUuid(String definitionUuid)
definitionUuid
- public String getUuid()
public int getRepeatTolerance()
public void setRepeatTolerance(int repeatTolerance)
public Boolean getRepeatToleranceEnabled()
public void setRepeatToleranceEnabled(Boolean repeatToleranceEnabled)
public boolean deeplyEquals(Object obj)
equals(Object)
of every field. This is used mainly for
reconciling the stack versus the database.obj
- public Alert buildAlert(double value, List<Object> args)
AlertState
and generate an alert with that state.public boolean equals(Object obj)
equals
in class Object
deeplyEquals(Object)
public Set<String> matchingHosts(Clusters clusters) throws org.apache.ambari.server.AmbariException
org.apache.ambari.server.AmbariException
Copyright © 2022 Apache Software Foundation. All rights reserved.