java.lang.Object
org.sentrysoftware.metricshub.engine.telemetry.Monitor

public class Monitor extends Object
Represents a monitoring entity with associated metrics, attributes, and alert rules.
  • Constructor Details

    • Monitor

      public Monitor()
  • Method Details

    • getMetric

      public <T extends AbstractMetric> T getMetric(String metricName, Class<T> type)
      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 null if not found.
    • getMetric

      public AbstractMetric getMetric(String metricName)
      Get a metric by metric name
      Parameters:
      metricName - The unique name of the metric
      Returns:
      AbstractMetric instance
    • addMetric

      public void addMetric(String metricName, AbstractMetric metric)
      Add a new metric in the map of metrics
      Parameters:
      metricName - The unique name of the metric
      metric - The metric instance to add
    • addAttributes

      public void addAttributes(@NonNull @NonNull Map<String,String> attributes)
      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

      public void addConditionalCollection(Map<String,String> conditionalCollection)
      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

      public void addLegacyParameters(Map<String,String> legacyTextParameters)
      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

      public void addAttribute(String key, String value)
      This method adds a new attribute to the current monitor
      Parameters:
      key - attribute key
      value - attribute value
    • getAttribute

      public String getAttribute(String key)
      This method gets an attribute from the current monitor using its key
      Parameters:
      key - attribute key
      Returns:
      attribute value
    • isMetricDeactivated

      public boolean isMetricDeactivated(String key)
      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 is host and represents an endpoint.
      Returns:
      true if the monitor is of type "host" and is an endpoint; false otherwise.
    • setIsEndpoint

      public void setIsEndpoint(boolean isEndpoint)
      Set isEndpoint to true or false
      Parameters:
      isEndpoint - boolean value
    • setAsEndpoint

      public void setAsEndpoint()
      Set the current monitor as endpoint