diff --git a/frontend/src/app/app-module/guides/guide-linux-agent/guide-linux-agent.component.ts b/frontend/src/app/app-module/guides/guide-linux-agent/guide-linux-agent.component.ts index 7e0966211..e6854c368 100644 --- a/frontend/src/app/app-module/guides/guide-linux-agent/guide-linux-agent.component.ts +++ b/frontend/src/app/app-module/guides/guide-linux-agent/guide-linux-agent.component.ts @@ -13,27 +13,7 @@ export class GuideLinuxAgentComponent implements OnInit { @Input() serverId: number; @Input() version: string; token: string; - - architectures = [ - { - id: 1, name: 'Ubuntu 16/18/20+', - install: this.getCommandUbuntu('utmstack-linux-agent'), - uninstall: this.getUninstallCommand('utmstack-linux-agent'), - shell: '' - }, - { - id: 2, name: 'Centos 7/Red Hat Enterprise Linux', - install: this.getCommandCentos7RedHat('utmstack-linux-agent'), - uninstall: this.getUninstallCommand('utmstack-linux-agent'), - shell: '' - }, - { - id: 3, name: 'Centos 8/AlmaLinux', - install: this.getCommandCentos8Almalinux('utmstack-linux-agent'), - uninstall: this.getUninstallCommand('utmstack-linux-agent'), - shell: '' - } - ]; + architectures = []; constructor(private federationConnectionService: FederationConnectionService) { } @@ -49,6 +29,7 @@ export class GuideLinuxAgentComponent implements OnInit { } else { this.token = ''; } + this.loadArchitectures(); }); } @@ -56,44 +37,64 @@ export class GuideLinuxAgentComponent implements OnInit { const ip = window.location.host.includes(':') ? window.location.host.split(':')[0] : window.location.host; return `sudo bash -c "apt update -y && apt install wget -y && mkdir -p /opt/utmstack-linux-agent && \ - wget --no-check-certificate --header='connection-key: ${this.token}' -P /opt/utmstack-linux-agent \ + wget --no-check-certificate --header='connection-key: ${this.token}' -P /opt/utmstack-linux-agent \ https://${ip}:9001/private/dependencies/agent/${installerName} && \ chmod -R 777 /opt/utmstack-linux-agent/${installerName} && \ - /opt/utmstack-linux-agent/${installerName} install ${ip} ${this.token} yes"`; + /opt/utmstack-linux-agent/${installerName} install ${ip} ${this.token} yes"`; } getCommandCentos7RedHat(installerName: string): string { const ip = window.location.host.includes(':') ? window.location.host.split(':')[0] : window.location.host; return `sudo bash -c "yum install wget -y && mkdir -p /opt/utmstack-linux-agent && \ - wget --no-check-certificate --header='connection-key: ${this.token}' -P /opt/utmstack-linux-agent \ + wget --no-check-certificate --header='connection-key: ${this.token}' -P /opt/utmstack-linux-agent \ https://${ip}:9001/private/dependencies/agent/${installerName} && \ chmod -R 777 /opt/utmstack-linux-agent/${installerName} && \ - /opt/utmstack-linux-agent/${installerName} install ${ip} ${this.token} yes"`; + /opt/utmstack-linux-agent/${installerName} install ${ip} ${this.token} yes"`; } getCommandCentos8Almalinux(installerName: string): string { const ip = window.location.host.includes(':') ? window.location.host.split(':')[0] : window.location.host; return `sudo bash -c "dnf install wget -y && mkdir -p /opt/utmstack-linux-agent && \ - wget --no-check-certificate --header='connection-key: ${this.token}' -P /opt/utmstack-linux-agent \ + wget --no-check-certificate --header='connection-key: ${this.token}' -P /opt/utmstack-linux-agent \ https://${ip}:9001/private/dependencies/agent/${installerName} && \ chmod -R 777 /opt/utmstack-linux-agent/${installerName} && \ - /opt/utmstack-linux-agent/${installerName} install ${ip} ${this.token} yes"`; + /opt/utmstack-linux-agent/${installerName} install ${ip} ${this.token} yes"`; } getUninstallCommand(installerName: string): string { return `sudo bash -c "/opt/utmstack-linux-agent/${installerName} uninstall || true; \ - systemctl stop UTMStackAgent 2>/dev/null || true; systemctl disable UTMStackAgent 2>/dev/null || true; \ - rm /etc/systemd/system/UTMStackAgent.service 2>/dev/null || true; systemctl stop UTMStackRedline 2>/dev/null || true; \ - systemctl disable UTMStackRedline 2>/dev/null || true; rm /etc/systemd/system/UTMStackRedline.service 2>/dev/null || true; \ - systemctl stop UTMStackUpdater 2>/dev/null || true; systemctl disable UTMStackUpdater 2>/dev/null || true; \ - rm /etc/systemd/system/UTMStackUpdater.service 2>/dev/null || true; systemctl stop UTMStackModulesLogsCollector 2>/dev/null || true; \ - systemctl disable UTMStackModulesLogsCollector 2>/dev/null || true; \ - rm /etc/systemd/system/UTMStackModulesLogsCollector.service 2>/dev/null || true; \ - systemctl daemon-reload 2>/dev/null || true; \ - echo 'Removing UTMStack Agent dependencies...' && sleep 10 && rm -rf /opt/utmstack-linux-agent && \ - echo 'UTMStack Agent dependencies removed successfully.'"`; + systemctl stop UTMStackAgent 2>/dev/null || true; systemctl disable UTMStackAgent 2>/dev/null || true; \ + rm -f /etc/systemd/system/UTMStackAgent.service 2>/dev/null || true; \ + systemctl stop UTMStackModulesLogsCollector 2>/dev/null || true; \ + systemctl disable UTMStackModulesLogsCollector 2>/dev/null || true; \ + rm -f /etc/systemd/system/UTMStackModulesLogsCollector.service 2>/dev/null || true; \ + systemctl daemon-reload 2>/dev/null || true; \ + echo 'Removing UTMStack Agent dependencies...' && sleep 10 && rm -rf /opt/utmstack-linux-agent 2>/dev/null || true; \ + echo 'UTMStack Agent dependencies removed successfully.'"`; } + private loadArchitectures() { + this.architectures = [ + { + id: 1, name: 'Ubuntu 16/18/20+', + install: this.getCommandUbuntu('utmstack_agent_service'), + uninstall: this.getUninstallCommand('utmstack_agent_service'), + shell: '' + }, + { + id: 2, name: 'Centos 7/Red Hat Enterprise Linux', + install: this.getCommandCentos7RedHat('utmstack_agent_service'), + uninstall: this.getUninstallCommand('utmstack_agent_service'), + shell: '' + }, + { + id: 3, name: 'Centos 8/AlmaLinux', + install: this.getCommandCentos8Almalinux('utmstack_agent_service'), + uninstall: this.getUninstallCommand('utmstack_agent_service'), + shell: '' + } + ]; + } } diff --git a/frontend/src/app/app-module/guides/guide-winlogbeat/guide-winlogbeat.component.ts b/frontend/src/app/app-module/guides/guide-winlogbeat/guide-winlogbeat.component.ts index 1959f773c..a7d2e7b4d 100644 --- a/frontend/src/app/app-module/guides/guide-winlogbeat/guide-winlogbeat.component.ts +++ b/frontend/src/app/app-module/guides/guide-winlogbeat/guide-winlogbeat.component.ts @@ -14,20 +14,7 @@ export class GuideWinlogbeatComponent implements OnInit { token: string; @Input() version: string; - architectures = [ - { - id: 1, name: 'AMD64', - install: this.getCommand('utmstack_agent_service.exe'), - uninstall: this.getUninstallCommand('utmstack_agent_service.exe'), - shell: 'Windows Powershell terminal as “ADMINISTRATOR”' - }, - { - id: 2, name: 'ARM64', - install: this.getCommand('utmstack_agent_service_arm64.exe'), - uninstall: this.getUninstallCommand('utmstack_agent_service_arm64.exe'), - shell: 'Windows Powershell terminal as “ADMINISTRATOR”' - } - ]; + architectures = []; constructor(private federationConnectionService: FederationConnectionService) { } @@ -44,9 +31,27 @@ export class GuideWinlogbeatComponent implements OnInit { } else { this.token = ''; } + this.loadArchitectures(); }); } + loadArchitectures(){ + this.architectures = [ + { + id: 1, name: 'AMD64', + install: this.getCommand('utmstack_agent_service.exe'), + uninstall: this.getUninstallCommand('utmstack_agent_service.exe'), + shell: 'Windows Powershell terminal as “ADMINISTRATOR”' + }, + { + id: 2, name: 'ARM64', + install: this.getCommand('utmstack_agent_service_arm64.exe'), + uninstall: this.getUninstallCommand('utmstack_agent_service_arm64.exe'), + shell: 'Windows Powershell terminal as “ADMINISTRATOR”' + } + ]; + } + getCommand(arch: string): string { const ip = window.location.host.includes(':') ? window.location.host.split(':')[0] : window.location.host;