Class ProtocolHealthCheckStrategy

java.lang.Object
org.sentrysoftware.metricshub.engine.strategy.AbstractStrategy
org.sentrysoftware.metricshub.engine.strategy.collect.ProtocolHealthCheckStrategy
All Implemented Interfaces:
Runnable, IStrategy

public class ProtocolHealthCheckStrategy extends AbstractStrategy
A strategy that aims to perform health check over a hostname on each protocol (HTTP, SNMP, IPMI, ...).

This aims to report the responsiveness of configured protocols on a resource. The health check is performed at the beginning of each data collection cycle, and a metric is generated for each protocol indicating whether it is responding or not.

  • Field Details

    • UP

      public static final Double UP
      Protocol up status value '1.0'
    • DOWN

      public static final Double DOWN
      Protocol down status value '0.0'
    • HTTP_UP_METRIC

      public static final String HTTP_UP_METRIC
      HTTP Up metric
    • SNMP_UP_METRIC

      public static final String SNMP_UP_METRIC
      SNMP Up metric
    • SSH_UP_METRIC

      public static final String SSH_UP_METRIC
      SSH Up metric
    • IPMI_UP_METRIC

      public static final String IPMI_UP_METRIC
      IPMI Up metric
    • WBEM_UP_METRIC

      public static final String WBEM_UP_METRIC
      WBEM Up metric
    • WMI_UP_METRIC

      public static final String WMI_UP_METRIC
      WMI Up metric
    • WINRM_UP_METRIC

      public static final String WINRM_UP_METRIC
      WINRM Up metric
    • SNMP_OID

      public static final String SNMP_OID
      The SNMP OID value to use in the health check test
      See Also:
    • SSH_TEST_COMMAND

      public static final String SSH_TEST_COMMAND
      SSH test command to execute
      See Also:
    • WBEM_UP_TEST_NAMESPACES

      public static final List<String> WBEM_UP_TEST_NAMESPACES
      List of WBEM protocol health check test Namespaces
    • WBEM_TEST_QUERY

      public static final String WBEM_TEST_QUERY
      WQL Query to test WBEM protocol health check
      See Also:
    • WMI_AND_WINRM_TEST_QUERY

      public static final String WMI_AND_WINRM_TEST_QUERY
      WQL Query to test WMI and WinRM protocols health check
      See Also:
    • WMI_AND_WINRM_TEST_NAMESPACE

      public static final String WMI_AND_WINRM_TEST_NAMESPACE
      WMI and WinRM protocol health check test Namespace
      See Also:
  • Constructor Details

    • ProtocolHealthCheckStrategy

      public ProtocolHealthCheckStrategy(@NonNull @NonNull TelemetryManager telemetryManager, @NonNull @NonNull Long strategyTime, @NonNull @NonNull ClientsExecutor clientsExecutor)
      Constructs a new HealthCheckStrategy using the provided telemetry manager, strategy time, and clients executor.
      Parameters:
      telemetryManager - The telemetry manager responsible for managing telemetry-related operations.
      strategyTime - The time when the strategy is executed.
      clientsExecutor - The executor for managing clients used in the strategy.
  • Method Details

    • run

      public void run()
    • getStrategyTimeout

      public long getStrategyTimeout()
      Description copied from interface: IStrategy
      Get the timeout of the strategy.
      Specified by:
      getStrategyTimeout in interface IStrategy
      Overrides:
      getStrategyTimeout in class AbstractStrategy
      Returns:
      long value representing the timeout in seconds.
    • getStrategyTime

      public Long getStrategyTime()
      Description copied from interface: IStrategy
      Provide the current time from which the strategy starts.
      Returns:
      Long value representing the start time of the strategy.
    • checkHttpHealth

      public void checkHttpHealth(String hostname, Monitor hostMonitor, MetricFactory metricFactory)
      Check HTTP protocol health on the hostname for the host monitor. Criteria: The HTTP GET request to "/" must return a result.
      Parameters:
      hostname - The hostname on which we perform health check
      hostMonitor - An endpoint host monitor
      metricFactory - The metric factory used to collect the health check metric
    • checkSnmpHealth

      public void checkSnmpHealth(String hostname, Monitor hostMonitor, MetricFactory metricFactory)
      Check SNMP protocol health on the hostname for the host monitor. Criteria: SNMP Get Next on '1.3.6.1' SNMP OID must be successful.
      Parameters:
      hostname - The hostname on which we perform health check
      hostMonitor - An endpoint host monitor
      metricFactory - The metric factory used to collect the health check metric
    • checkSshHealth

      public void checkSshHealth(String hostname, Monitor hostMonitor, MetricFactory metricFactory)
      Check SSH protocol health on the hostname for the host monitor. Criteria: The echo command must be working.
      Parameters:
      hostname - The hostname on which we perform health check
      hostMonitor - An endpoint host monitor
      metricFactory - The metric factory used to collect the health check metric metric
    • checkIpmiHealth

      public void checkIpmiHealth(String hostname, Monitor hostMonitor, MetricFactory metricFactory)
      Check Ipmi protocol health on the hostname for the host monitor. Criteria: The getChassisStatusAsStringResult IPMI Client request request must return a result.
      Parameters:
      hostname - The hostname on which we perform health check
      hostMonitor - An endpoint host monitor
      metricFactory - The metric factory used to collect the health check metric
    • checkWbemHealth

      public void checkWbemHealth(String hostname, Monitor hostMonitor, MetricFactory metricFactory)
      Check WBEM protocol health on the hostname for the host monitor.
      • Criteria: The query must not return an error for at least one of the following namespaces: "root/Interop", "interop", "root/PG_Interop", "PG_Interop"
      • Query: SELECT Name FROM CIM_NameSpace.
      • Success Conditions: CIM_ERR_INVALID_NAMESPACE and CIM_ERR_NOT_FOUND errors are considered successful, indicating that the protocol is responding.
      Parameters:
      hostname - The hostname on which we perform health check
      hostMonitor - An endpoint host monitor
      metricFactory - The metric factory used to collect the health check metric
    • checkWmiHealth

      public void checkWmiHealth(String hostname, Monitor hostMonitor, MetricFactory metricFactory)
      Check WMI protocol health on the hostname for the host monitor.
      • Criteria: The query must not return an error for at least one of the root\cimv2 namespace.
      • Query: SELECT Name FROM Win32_ComputerSystem.
      • Success Conditions: No errors in the query result, indicating that the protocol is responding.
      Parameters:
      hostname - The hostname on which we perform health check
      hostMonitor - An endpoint host monitor
      metricFactory - The metric factory used to collect the health check metric
    • checkWinRmHealth

      public void checkWinRmHealth(String hostname, Monitor hostMonitor, MetricFactory metricFactory)
      Check WINRM protocol health on the hostname for the host monitor.
      • Criteria: The query must not return an error for at least one of the root\cimv2 namespace.
      • Query: SELECT Name FROM Win32_ComputerSystem.
      • Success Conditions: No errors in the query result, indicating that the protocol is responding.
      Parameters:
      hostname - The hostname on which we perform health check
      hostMonitor - An endpoint host monitor
      metricFactory - The metric factory used to collect the health check metric