Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop OS Command Extension #116

Closed
29 tasks done
NassimBtk opened this issue Mar 15, 2024 · 0 comments
Closed
29 tasks done

Develop OS Command Extension #116

NassimBtk opened this issue Mar 15, 2024 · 0 comments
Assignees

Comments

@NassimBtk
Copy link
Member

NassimBtk commented Mar 15, 2024

Description

Check List

Agent

  • Remove the OsCommandProtocolConfig class.
  • In ConfigHelper move the validateOsCommandInfo() and validateSshInfo() methods content to the OsCommandConfiguration and SshConfiguration class which is located in the metricshub-oscommand-extension. And adapt the ConfigHelper code so that we call IConfiguration#validateConfiguration (OsCommandConfiguration and SshConfiguration) to validate the content of the OsCommand and SSH configuration.
  • Add the IConfiguration instance for oscommand and ssh to the final Map<Class<? extends IConfiguration>, IConfiguration> protocolConfigurations map which is built in ConfigHelper#buildHostConfiguration.
  • In the MetricsHub CLI, adapt the OsCommandConfigCli class.
  • Re-write sshConfigCli.toProtocol to call the extensionManager instance responsible of building the right IConfiguration for OsCommand protocol.
  • If it is required to build a new configuration for OS Command in the unit tests then create a OsCommandTestConfiguration class and create its extension OsCommandTestExtension.
  • Remove ConfigHelperTest#testValidateOsCommandInfo() and ConfigHelperTest#testValidateSshInfo() because the validation will be moved to the OsCommandConfiguration class in the metricshub-oscommand-extension.
  • Adapt the TaskSchedulingServiceTest to replace the removed classes by the extension classes E.g. OsCommandTestConfiguration.
  • Adapt the SshConfigCliTest tests. Probably Static Mocks will be involved.

Engine

  • Remove the org.sentrysoftware:ssh dependency from metricshub-engine POM.
  • Move OsCommandHelper code to the metricshub-oscommand-extension. Make sure to remove the call from the OsCommandHelper.run* method and adapt the caller (SourceProcessor CriterionProcessor) to invoke the extensionManager correctly.
  • Remove OsCommandConfiguration.class and SshConfiguration.class mapping from the HostConfiguration#CONFIGURATION_TO_SOURCES_MAP map.
  • Move OsCommandConfiguration.java to metricshub-oscommand-extension module.
  • Move ProtocolHealthCheckStrategy#checkSshHealth to OsCommandExtension located at the metricshub-oscommand-extension module. Make sure to remove the unused constants and methods.
  • Move the code of the method: CriterionProcessor#CriterionTestResult process(@SpanAttribute("criterion.definition") OsCommandCriterion OsCommandCriterion) to the appropriate class in the metricshub-oscommand-extension module and call the extensionManager in this process method to execute criterion.
  • Move the code of the method: SourceProcessor#process(@SpanAttribute("source.definition") final OsCommandSource oscommandSource) to the appropriate class in the metricshub-oscommand-extension module and call the extensionManager in this process method to execute the source.
  • Move the OsCommandConfigurationTest class to the extension unit tests.
  • Move the SshConfigurationTest class to the extension unit tests.
  • Adapt correct engine unit tests because the code is moved to another module.

Extension

  • Implement the IProtocolExtension class.
  • Make sure to accept both OsCommandConfiguration and SshConfiguration, this means that metricshub-oscommand-extension depends on the metricshub-oscommand-extension
  • Make sure to implement native OS Command executions and Ssh commands through OS Command Helper.
  • Make sure to define the /metricshub-oscommand-extension/src/main/resources/META-INF/services/org.sentrysoftware.metricshub.engine.extension.IProtocolExtension file so that the ServiceLoader loads the extension implementation correctly at runtime.
  • Add the metricshub-engine,lombok, jupiter,jackson (all the necessary dependencies) in the extension project's POM.
  • Make sure to create a jar using the maven-shade-plugin (POM)
  • Make sure to include the required dependencies (org.sentrysoftware:ssh and org.sentrysoftware:metricshub-oscommand-extension)
  • Develop unit tests.

Packaging Windows and Linux

  • Add the metricshub-oscommand-extension as dependency.
  • Update the maven-dependency-plugin, execution-id: unpack-extensions and add the artifactItem defining the metricshub-oscommand-extension.
CherfaElyes added a commit that referenced this issue Apr 23, 2024
* Developed Os Command Extension
* Made all the necessary changes on metricshub engine and agent
* Tested the code using the metricshub CLI and the agent
CherfaElyes added a commit that referenced this issue Apr 23, 2024
* Refactored all unit tests
* Refactored Super Connector Integration Test
* Added Javadoc
* Code enhancement
CherfaElyes added a commit that referenced this issue Apr 23, 2024
* Refactored SshConfiguration and OsCommandConfiguration
* Added unit tests
CherfaElyes added a commit that referenced this issue Apr 23, 2024
* Completed Javadoc
* Merged the EPIC branch into the current branch
* Made all the necessary changes
* Tested the metricshub using the Engine and the Agent
NassimBtk added a commit that referenced this issue Apr 24, 2024
* Implemented a new class `SudoInformation` to wrap information such as
whether to use sudo, the sudo commands that require sudo and the sudo
command key.

* Prepare OsCommandHelper to be defined in the engine to define a set of
utilities that are required in various extensions.
CherfaElyes added a commit that referenced this issue Apr 24, 2024
* Refactored OsCommandHelper to be OsCommandService
* Moved back OsCommandResult to the metricshub engine
CherfaElyes added a commit that referenced this issue Apr 24, 2024
* Split OsCommandHelper into OsCommandHelper that was moved back to the MetricsHub engine since it's used by metricshub-wmi-extension and metricshub-winrm-extension. This also led to the creation of  OsCommandService which is responsible for creating embeddedFiles, and pre-processing the Os Command queries before executing them by the OsCommandRequestExecutor.
* Refactored tests to mock the right classes (OsCommandService or OsCommandHelper).
* Corrected a tiny CLI display bug
CherfaElyes added a commit that referenced this issue Apr 24, 2024
* Added and fixed javadoc
CherfaElyes added a commit that referenced this issue Apr 25, 2024
* Corrected license headers
NassimBtk added a commit that referenced this issue Apr 26, 2024
…-os-command-extension

Issue #116: Develop OS Command Extension
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

When branches are created from issues, their pull requests are automatically linked.

2 participants