Skip to content

Commit

Permalink
elkmanager added.
Browse files Browse the repository at this point in the history
  • Loading branch information
foroughsh committed Aug 2, 2024
1 parent a4d25ec commit 154f2e3
Showing 1 changed file with 9 additions and 13 deletions.
22 changes: 9 additions & 13 deletions simulation-system/libs/csle-cli/src/csle_cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -1051,7 +1051,7 @@ def stop_elk_manager(ip: str, emulation: str, ip_first_octet: int) -> None:
for node in config.cluster_config.cluster_nodes:
if node.ip == ip or ip == "":
stopped = ClusterController.stop_elk_manager(ip=ip, port=constants.GRPC_SERVERS.CLUSTER_MANAGER_PORT,
emulation=emulation, ip_first_octet=ip_first_octet)
emulation=emulation, ip_first_octet=ip_first_octet)
if stopped.outcome:
click.secho(f"Stopping elk manager on port:{constants.GRPC_SERVERS.CLUSTER_MANAGER_PORT}")
else:
Expand Down Expand Up @@ -1651,10 +1651,9 @@ def start_elk_manager(ip: str, emulation: str, ip_first_octet: int):
config = MetastoreFacade.get_config(id=1)
for node in config.cluster_config.cluster_nodes:
if node.ip == ip or ip == "":
operation_outcome = ClusterController.start_elk_manager(ip=ip,
port=constants.GRPC_SERVERS.CLUSTER_MANAGER_PORT,
emulation=emulation,
ip_first_octet=ip_first_octet)
operation_outcome = ClusterController.start_elk_manager(
ip=ip, port=constants.GRPC_SERVERS.CLUSTER_MANAGER_PORT, emulation=emulation,
ip_first_octet=ip_first_octet)
if operation_outcome.outcome:
click.secho(f"Starting elk manager on port:{constants.GRPC_SERVERS.CLUSTER_MANAGER_PORT}")
else:
Expand Down Expand Up @@ -2111,8 +2110,8 @@ def list_elk_manager(ip: str, emulation: str, ip_first_octet: int) -> None:
ip=ip, port=constants.GRPC_SERVERS.CLUSTER_MANAGER_PORT, emulation=emulation,
ip_first_octet=ip_first_octet)
for i in range(len(elk_manager_info.ips)):
status_color = 'green' if elk_manager_info.elkManagersRunning[i] == True else 'red'
manager_status = 'Running' if elk_manager_info.elkManagersRunning[i] == True else 'Stopped'
status_color = 'green' if elk_manager_info.elkManagersRunning[i] else 'red'
manager_status = 'Running' if elk_manager_info.elkManagersRunning[i] else 'Stopped'
click.secho('+' + '-' * 60 + '+', fg='white')
click.secho(f'|{"Elk manager IP":^40}', nl=False, fg='white')
click.secho('|', nl=False, fg='white')
Expand All @@ -2127,26 +2126,23 @@ def list_elk_manager(ip: str, emulation: str, ip_first_octet: int) -> None:
if manager_status == "Running":
click.secho(f'|{"Elk manager elasticRunning":^40}', nl=False, fg='white')
click.secho('|', nl=False, fg='white')
elasticRunning = 'True' if elk_manager_info.elkManagersStatuses[0].elasticRunning == True \
else 'False'
elasticRunning = 'True' if elk_manager_info.elkManagersStatuses[0].elasticRunning else 'False'
click.secho(f'{elasticRunning:<19}',
nl=False, fg=status_color)
click.secho('|', fg='white')
click.secho('+' + '-' * 60 + '+', fg='white')

click.secho(f'|{"Elk manager kibanaRunning":^40}', nl=False, fg='white')
click.secho('|', nl=False, fg='white')
kibanaRunning = 'True' if elk_manager_info.elkManagersStatuses[0].kibanaRunning == True \
else 'False'
kibanaRunning = 'True' if elk_manager_info.elkManagersStatuses[0].kibanaRunning else 'False'
click.secho(f'{kibanaRunning:<19}',
nl=False, fg=status_color)
click.secho('|', fg='white')
click.secho('+' + '-' * 60 + '+', fg='white')

click.secho(f'|{"Elk manager logstashRunning":^40}', nl=False, fg='white')
click.secho('|', nl=False, fg='white')
logstashRunning = 'True' if elk_manager_info.elkManagersStatuses[0].logstashRunning == True \
else 'False'
logstashRunning = 'True' if elk_manager_info.elkManagersStatuses[0].logstashRunning else 'False'
click.secho(f'{logstashRunning:<19}',
nl=False, fg=status_color)
click.secho('|', fg='white')
Expand Down

0 comments on commit 154f2e3

Please sign in to comment.