Class CriterionProcessor
java.lang.Object
org.sentrysoftware.metricshub.engine.strategy.detection.CriterionProcessor
- All Implemented Interfaces:
ICriterionProcessor
The `CriterionProcessor` class is responsible for processing various criteria,
facilitating detection operations related to different aspects such as IPMI, HTTP, SNMP, etc.
This class integrates with ClientsExecutor and TelemetryManager to execute criterion-specific tests and log relevant information. It also utilizes a WqlDetectionHelper for Windows Management Instrumentation (WMI) queries.
The class includes methods for processing different types of criteria, such as IpmiCriterion, HttpCriterion, DeviceTypeCriterion.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classA test result class containing a message, success status, and CSV table. -
Constructor Summary
ConstructorsConstructorDescriptionCriterionProcessor(ClientsExecutor clientsExecutor, TelemetryManager telemetryManager, String connectorId) Constructor for the CriterionProcessor class. -
Method Summary
Modifier and TypeMethodDescriptionbuildIpmiCommand(DeviceKind hostType, String hostname, SshConfiguration sshConfiguration, OsCommandConfiguration osCommandConfiguration, int defaultTimeout) Check the OS type and version and build the correct IPMI command.getIpmiCommandForSolaris(String ipmitoolCommand, String hostname, String solarisOsVersion) Get IPMI command based on Solaris version.booleanisDeviceKindIncluded(List<DeviceKind> deviceKindList, DeviceTypeCriterion deviceTypeCriterion) Return true if the deviceKind in the deviceKindList is included in the DeviceTypeCriterion detection.process(DeviceTypeCriterion deviceTypeCriterion) Process the givenDeviceTypeCriterionand return theCriterionTestResultprocess(HttpCriterion httpCriterion) Process the givenHttpCriterionthrough Client and return theCriterionTestResultprocess(IpmiCriterion ipmiCriterion) Process the givenIpmiCriterionthrough Client and return theCriterionTestResultprocess(OsCommandCriterion osCommandCriterion) Process the givenOsCommandCriterionthrough Client and return theCriterionTestResultprocess(ProcessCriterion processCriterion) Process the givenProcessCriterionthrough Client and return theCriterionTestResultprocess(ProductRequirementsCriterion productRequirementsCriterion) Process the givenProductRequirementsCriterionand return theCriterionTestResult.process(ServiceCriterion serviceCriterion) Process the givenServiceCriterionthrough Client and return theCriterionTestResultprocess(SnmpGetCriterion snmpGetCriterion) Process the givenSnmpGetCriterionthrough Client and return theCriterionTestResultprocess(SnmpGetNextCriterion snmpGetNextCriterion) Process the givenSnmpGetNextCriterionthrough Client and return theCriterionTestResultprocess(WbemCriterion wbemCriterion) Process the givenWbemCriterionthrough Client and return theCriterionTestResultprocess(WmiCriterion wmiCriterion) Process the givenWmiCriterionthrough Client and return theCriterionTestResult
-
Constructor Details
-
CriterionProcessor
public CriterionProcessor(ClientsExecutor clientsExecutor, TelemetryManager telemetryManager, String connectorId) Constructor for the CriterionProcessor class.- Parameters:
clientsExecutor- The ClientsExecutor instance.telemetryManager- The TelemetryManager instance.connectorId- The connector ID.
-
-
Method Details
-
process
Process the givenDeviceTypeCriterionand return theCriterionTestResult- Specified by:
processin interfaceICriterionProcessor- Parameters:
deviceTypeCriterion- The DeviceTypeCriterion to process.- Returns:
- New
CriterionTestResultinstance.
-
isDeviceKindIncluded
public boolean isDeviceKindIncluded(List<DeviceKind> deviceKindList, DeviceTypeCriterion deviceTypeCriterion) Return true if the deviceKind in the deviceKindList is included in the DeviceTypeCriterion detection.- Parameters:
deviceKindList- The list of DeviceKind values to check.deviceTypeCriterion- The DeviceTypeCriterion for detection.- Returns:
- True if the deviceKind in the deviceKindList is included; otherwise, false.
-
process
Process the givenHttpCriterionthrough Client and return theCriterionTestResult- Specified by:
processin interfaceICriterionProcessor- Parameters:
httpCriterion- The HTTP criterion to process.- Returns:
- New
CriterionTestResultinstance.
-
process
Process the givenIpmiCriterionthrough Client and return theCriterionTestResult- Specified by:
processin interfaceICriterionProcessor- Parameters:
ipmiCriterion- The IPMI criterion to process.- Returns:
- CriterionTestResult instance.
-
buildIpmiCommand
public String buildIpmiCommand(DeviceKind hostType, String hostname, SshConfiguration sshConfiguration, OsCommandConfiguration osCommandConfiguration, int defaultTimeout) Check the OS type and version and build the correct IPMI command. If the process fails, return the corresponding error.- Parameters:
hostType- The type of the host.hostname- The hostname.sshConfiguration- The SSH configuration.osCommandConfiguration- The OS command configuration.defaultTimeout- The default timeout.- Returns:
- String : The IPMI Command.
-
getIpmiCommandForSolaris
public String getIpmiCommandForSolaris(String ipmitoolCommand, String hostname, String solarisOsVersion) throws IpmiCommandForSolarisException Get IPMI command based on Solaris version. If version == 9, then use 'lipmi'. If version > 9, then use 'bmc'. Otherwise, return an error.- Parameters:
ipmitoolCommand- The base IPMI tool command.hostname- The hostname.solarisOsVersion- The Solaris OS version.- Returns:
- String : IPMI command for Solaris.
- Throws:
IpmiCommandForSolarisException- If an error occurs while determining the IPMI command.
-
process
Process the givenOsCommandCriterionthrough Client and return theCriterionTestResult- Specified by:
processin interfaceICriterionProcessor- Parameters:
osCommandCriterion- TheOsCommandCriterionto process.- Returns:
CriterionTestResultinstance.
-
process
Process the givenProcessCriterionthrough Client and return theCriterionTestResult- Specified by:
processin interfaceICriterionProcessor- Parameters:
processCriterion- TheProcessCriterionto process.- Returns:
CriterionTestResultinstance.
-
process
Process the givenProductRequirementsCriterionand return theCriterionTestResult.- Specified by:
processin interfaceICriterionProcessor- Parameters:
productRequirementsCriterion- TheProductRequirementsCriterionto process.- Returns:
CriterionTestResultinstance.
-
process
Process the givenServiceCriterionthrough Client and return theCriterionTestResult- Specified by:
processin interfaceICriterionProcessor- Parameters:
serviceCriterion- TheServiceCriterionto process.- Returns:
CriterionTestResultinstance.
-
process
Process the givenSnmpGetCriterionthrough Client and return theCriterionTestResult- Specified by:
processin interfaceICriterionProcessor- Parameters:
snmpGetCriterion- The SNMP Get criterion to process.- Returns:
- The result of the criterion test.
-
process
Process the givenSnmpGetNextCriterionthrough Client and return theCriterionTestResult- Specified by:
processin interfaceICriterionProcessor- Parameters:
snmpGetNextCriterion- The SNMP GetNext criterion to process.- Returns:
- The result of the criterion test.
-
process
Process the givenWmiCriterionthrough Client and return theCriterionTestResult- Specified by:
processin interfaceICriterionProcessor- Parameters:
wmiCriterion- The WMI criterion to process.- Returns:
- The result of the criterion test processing.
-
process
Process the givenWbemCriterionthrough Client and return theCriterionTestResult- Specified by:
processin interfaceICriterionProcessor- Parameters:
wbemCriterion- The WBEM criterion to process.- Returns:
- The result of the criterion test processing.
-