Skip to content

Commit

Permalink
Add configuration analysis report enhancement
Browse files Browse the repository at this point in the history
* add Configuration Analysis Report generation option (--car) used by services team, issue #127
  • Loading branch information
alexafshar authored Oct 5, 2023
1 parent ddb28b2 commit 6c963ab
Show file tree
Hide file tree
Showing 8 changed files with 570 additions and 32 deletions.
47 changes: 36 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ There are four options to run the tool:
1. [UI Method](https://github.com/Appdynamics/config-assessment-tool#ui-method)
- Run jobs from a convenient web based UI
- Easier way to configure jobs but requires Python and Docker installation
2. [Platform executable](https://github.com/Appdynamics/config-assessment-tool#platform-executable)
2. [Platform executable](https://github.com/Appdynamics/config-assessment-tool#platform-executable). (Preferred method for most users running Windows and Linux)
- A self contained OS specific bundle if you are not using Docker and Python. Bundles available for Linux and Windows
- Recommended for users that do not wish to install Python and Docker and/or can not access external repositories
3. [Directly via Docker](https://github.com/Appdynamics/config-assessment-tool#directly-via-docker)
Expand All @@ -35,9 +35,9 @@ The tool expects ONLY the following permissions to be given:
- Administrator (Default)
- Analytics Administrator (Default)

### UI method
### 1) UI method

Obtain frontend and backend Docker images via:
This method will automatically create local Docker images if not already in the local registry and runs them using the newly built images:

1. Download or clone the latest `Source Code.zip` from [here](https://github.com/Appdynamics/config-assessment-tool/releases)
2. `cd config-assessment-tool`
Expand All @@ -50,7 +50,7 @@ Add new Jobs or Thresholds to `config_assessment_tool/resources/jobs` and `confi

Refresh the page to see the Jobs and Thresholds appear.

### Platform executable
### 2) Platform executable

Use this method if you are not able to use Docker or Python in your target deployment environment. Currently, platform bundles are available for x86 Windows and Linux only. Currently arm architectures are not supported.

Expand Down Expand Up @@ -79,12 +79,26 @@ config-assessment-tool-<OS>-<version>/
└── ...
```
To see a list of options you may use the ```--help``` when running the executable command. Available options are listed below.
```
Usage: config-assessment-tool [OPTIONS]
### Directly via Docker
Where below OPTIONS are available:
You can start the backend container with the following command:
Options:
-j, --job-file TEXT
-t, --thresholds-file TEXT
-d, --debug
-c, --concurrent-connections INTEGER
-u, --username TEXT Adds the option to put username dynamically
-p, --password TEXT Adds the option to put password dynamically
--car Generate the configration analysis report as part of the output
--help Show this help message and exit.
```

### 3) Directly via Docker

Unix
You can start the backend container with the following command:

```
docker run \
Expand Down Expand Up @@ -112,7 +126,7 @@ docker run `
ghcr.io/appdynamics/config-assessment-tool-backend-{platform}:{tag} -j DefaultJob -t DefaultThresholds
```

### From Source
### 4) From Source

#### Steps to run

Expand All @@ -124,15 +138,22 @@ Required
4. `pipenv shell`
5. `python3 backend/backend.py -j DefaultJob -t DefaultThresholds`

To see a list of options you may use the ```--help``` flag when running the backend command. Available options are listed below.

```
Usage: backend.py [OPTIONS]
Where below OPTIONS are available:
Options:
-j, --job-file TEXT
-t, --thresholds-file TEXT
-d, --debug
-c, --concurrent-connections INTEGER
--help Show this message and exit.
-u, --username TEXT Adds the option to put username dynamically
-p, --password TEXT Adds the option to put password dynamically
--car Generate the configration analysis report as part of the output
--help Show this help message and exit
```

Options `--job-file` and `--thresholds-file` will default to `DefaultJob` and `DefaultThresholds` respectively.
Expand Down Expand Up @@ -165,6 +186,10 @@ This program will create the following files in the `out` directory.
- Raw metrics which go into MaturityAssessment for BRUM report
- `{jobName}-MaturityAssessmentRaw-mrum.xlsx`
- Raw metrics which go into MaturityAssessment for MRUM report
- `{jobName}-HybridApplicationMonitoringUseCaseMaturityAssessment-presentation.pptx
- Primarily used by customers that have purchased the Hybrid App Monitoring(HAM) SKU's
- `{jobName}-ConfigurationAnalysisReport.xlsx`
- Configuration Analysis Report used primarily by AppD Services team, generated separately
- `controllerData.json`
- Contains all raw data used in analysis.
- `info.json`
Expand Down Expand Up @@ -247,9 +272,9 @@ For example: Use HTTPS_PROXY environment variable if your controller is accessib

## Support

For general feature requests or questions/feedback please create an issue in this Github repository.
For general feature requests or questions/feedback please create an issue in this Github repository. Ensure that no proprietary information is included in the issue or attachments as this is an open source project with public visibility.

If you are having difficulty running the tool email Alex Afshar at [email protected] and attach debug logs.
If you are having difficulty running the tool email Alex Afshar at [email protected] and attach any relevant information including debug logs.

Debug logs can be taken by either:

Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v1.5.9.9
v1.6
5 changes: 3 additions & 2 deletions backend/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@
@click.option("-c", "--concurrent-connections", type=int)
@click.option("-u", "--username", default=None, help="Adds the option to put username dynamically")
@click.option("-p", "--password", default=None, help="Adds the option to put password dynamically")
@click.option("--car", is_flag=True, help="Generate the configration analysis report as part of the output")
@coro
async def main(job_file: str, thresholds_file: str, debug, concurrent_connections: int, username: str, password: str):
async def main(job_file: str, thresholds_file: str, debug, concurrent_connections: int, username: str, password: str, car: bool):
initLogging(debug)
engine = Engine(job_file, thresholds_file, concurrent_connections, username, password)
engine = Engine(job_file, thresholds_file, concurrent_connections, username, password, car)
await engine.run()


Expand Down
27 changes: 26 additions & 1 deletion backend/core/Engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from pathlib import Path

import requests

from api.appd.AppDService import AppDService
from extractionSteps.general.ControllerLevelDetails import ControllerLevelDetails
from extractionSteps.general.CustomMetrics import CustomMetrics
Expand All @@ -30,9 +31,11 @@
from extractionSteps.maturityAssessment.mrum.HealthRulesAndAlertingMRUM import HealthRulesAndAlertingMRUM
from extractionSteps.maturityAssessment.mrum.NetworkRequestsMRUM import NetworkRequestsMRUM
from extractionSteps.maturityAssessment.mrum.OverallAssessmentMRUM import OverallAssessmentMRUM
from output.PostProcessReport import PostProcessReport
from output.presentations.cxPpt import createCxPpt
from output.presentations.cxPptFsoUseCases import createCxHamUseCasePpt
from output.reports.AgentMatrixReport import AgentMatrixReport
from output.reports.ConfigurationAnalysisReport import ConfigurationAnalysisReport
from output.reports.CustomMetricsReport import CustomMetricsReport
from output.reports.DashboardReport import DashboardReport
from output.reports.LicenseReport import LicenseReport
Expand All @@ -44,7 +47,10 @@


class Engine:
def __init__(self, jobFileName: str, thresholdsFileName: str, concurrentConnections: int, username: str, password: str):
def __init__(self, jobFileName: str, thresholdsFileName: str, concurrentConnections: int, username: str, password: str, car: bool):

# should we run the configuration analysis report in post-processing?
self.car = car

if getattr(sys, "frozen", False) and hasattr(sys, "_MEIPASS"):
# running as executable bundle
Expand All @@ -62,6 +68,7 @@ def __init__(self, jobFileName: str, thresholdsFileName: str, concurrentConnecti
self.codebaseVersion = open(f"VERSION").read()
logging.info(f"Running Software Version: {self.codebaseVersion}")


# Validate jobFileName and thresholdFileName
self.jobFileName = jobFileName
self.thresholdsFileName = thresholdsFileName
Expand Down Expand Up @@ -196,6 +203,7 @@ async def run(self):
await self.validateThresholdsFile()
await self.initControllers()
await self.process()
await self.postProcess()
self.finalize(startTime)
except Exception as e:
# catch exceptions here, so we can terminate coroutines before program exit
Expand Down Expand Up @@ -396,3 +404,20 @@ async def abortAndCleanup(self, msg: str, error=True):
if msg:
logging.info(msg)
sys.exit(0)

async def postProcess(self):
"""Post-processing reports that rely on the core generated excel reports.
Currently, for CAR(configuration analysis report) that consumes the core
reports post process
"""
logging.info(f"----------Post Process----------")
commands = []

if self.car:
commands.append(ConfigurationAnalysisReport())

for command in commands:
if isinstance(command, PostProcessReport):
await command.post_process(self.jobFileName)

logging.info(f"----------Post Process Done----------")
10 changes: 10 additions & 0 deletions backend/output/PostProcessReport.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from abc import ABC, abstractmethod


class PostProcessReport(ABC):
@abstractmethod
async def post_process(self, report_names):
"""
execute post processing reports
"""
pass
Loading

0 comments on commit 6c963ab

Please sign in to comment.