Class Monitor
java.lang.Object
org.sentrysoftware.metricshub.engine.telemetry.Monitor
Represents a monitoring entity with associated metrics, attributes, and alert rules.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAttribute(String key, String value) This method adds a new attribute to the current monitorvoidaddAttributes(@NonNull Map<String, String> attributes) Add the given attributes to the current map of attributesvoidaddConditionalCollection(Map<String, String> conditionalCollection) Add the given conditionalCollection map to the current map of conditionalCollectionvoidaddLegacyParameters(Map<String, String> legacyTextParameters) Add the given legacyTextParameters map to the current map of legacyTextParametersvoidaddMetric(String metricName, AbstractMetric metric) Add a new metric in the map of metricsgetAttribute(String key) This method gets an attribute from the current monitor using its keyGet a metric by metric name<T extends AbstractMetric>
TGets a metric of the specified type by name.booleanThis method checks if the monitor type ishostand represents an endpoint.booleanThis method returns whether a metric is deactivatedvoidSet the current monitor as endpointvoidsetIsEndpoint(boolean isEndpoint) Set isEndpoint totrueorfalse
-
Constructor Details
-
Monitor
public Monitor()
-
-
Method Details
-
getMetric
Gets a metric of the specified type by name.- Type Parameters:
T- The metric type T- Parameters:
metricName- The unique name of the metric.type- The type of the metric.- Returns:
- The metric instance, or
nullif not found.
-
getMetric
Get a metric by metric name- Parameters:
metricName- The unique name of the metric- Returns:
AbstractMetricinstance
-
addMetric
Add a new metric in the map of metrics- Parameters:
metricName- The unique name of the metricmetric- The metric instance to add
-
addAttributes
Add the given attributes to the current map of attributes- Parameters:
attributes- Map of key-pair values to be added to the current map of attributes
-
addConditionalCollection
Add the given conditionalCollection map to the current map of conditionalCollection- Parameters:
conditionalCollection- Map of key-pair values to be added to the current map of conditionalCollection
-
addLegacyParameters
Add the given legacyTextParameters map to the current map of legacyTextParameters- Parameters:
legacyTextParameters- Map of key-pair values to be added to the current map of legacyTextParameters
-
addAttribute
This method adds a new attribute to the current monitor- Parameters:
key- attribute keyvalue- attribute value
-
getAttribute
This method gets an attribute from the current monitor using its key- Parameters:
key- attribute key- Returns:
- attribute value
-
isMetricDeactivated
This method returns whether a metric is deactivated- Parameters:
key- metric key- Returns:
- boolean
-
isEndpointHost
public boolean isEndpointHost()This method checks if the monitor type ishostand represents an endpoint.- Returns:
trueif the monitor is of type "host" and is an endpoint;falseotherwise.
-
setIsEndpoint
public void setIsEndpoint(boolean isEndpoint) Set isEndpoint totrueorfalse- Parameters:
isEndpoint- boolean value
-
setAsEndpoint
public void setAsEndpoint()Set the current monitor as endpoint
-