Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,14 @@ export class GuideUtmstackComponent implements OnInit {
this.architectures = [
{
id: 1, name: 'Ubuntu 16/18/20+',
install: this.getCommandUbuntu('utmstack_agent_service'),
uninstall: this.getUninstallCommand('utmstack_agent_service'),
install: this.getCommandUbuntu('utmstack_collector'),
uninstall: this.getUninstallCommandUbuntu('utmstack_collector'),
shell: ''
},
{
id: 2, name: 'Centos 7/Red Hat Enterprise Linux',
install: this.getCommandCentos7RedHat('utmstack_agent_service'),
uninstall: this.getUninstallCommand('utmstack_agent_service'),
id: 2, name: 'CentOS 8+/Red Hat Enterprise Linux',
install: this.getCommandCentos7RedHat('utmstack_collector'),
uninstall: this.getUninstallCommandRedHat('utmstack_collector'),
shell: ''
},
];
Expand All @@ -81,29 +81,47 @@ export class GuideUtmstackComponent implements OnInit {
getCommandUbuntu(installerName: string): string {
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-collector && \
return `sudo bash -c "apt update -y && \
apt install wget -y && \
mkdir -p /opt/utmstack-collector && \
wget --no-check-certificate -P /opt/utmstack-collector \
https://${ip}:9001/private/dependencies/collector/${installerName} && \
chmod -R 777 /opt/utmstack-collector/${installerName} && \
/opt/utmstack-collector/${installerName} install ${ip} <secret>${this.token}</secret> 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-collector && \
return `sudo bash -c "dnf update -y && \
dnf install wget -y && \
mkdir -p /opt/utmstack-collector && \
wget --no-check-certificate -P /opt/utmstack-collector \
https://${ip}:9001/private/dependencies/collector/${installerName} && \
chmod -R 777 /opt/utmstack-collector/${installerName} && \
/opt/utmstack-collector/${installerName} install ${ip} <secret>${this.token}</secret> yes"`;
}

getUninstallCommand(installerName: string): string {
return `sudo bash -c "/opt/utmstack-collector/${installerName} uninstall || true; \
systemctl stop UTMStackCollector 2>/dev/null || true; systemctl disable UTMStackCollector 2>/dev/null || true; \
rm -f /etc/systemd/system/UTMStackCollector.service 2>/dev/null || true; \
systemctl daemon-reload 2>/dev/null || true; \
echo 'Removing UTMStack Collector dependencies...' && sleep 10 && rm -rf /opt/utmstack-collector 2>/dev/null || true; \
echo 'UTMStack Collector dependencies removed successfully.'"`;
getUninstallCommandUbuntu(installerName: string): string {
return `sudo bash -c "/opt/utmstack-collector/${installerName} uninstall && \
(systemctl stop UTMStackCollector 2>/dev/null || service UTMStackCollector stop 2>/dev/null || true) && \
(systemctl disable UTMStackCollector 2>/dev/null || chkconfig UTMStackCollector off 2>/dev/null || true) && \
rm -rf /opt/utmstack-collector && \
rm -f /etc/systemd/system/UTMStackCollector.service && \
rm -f /etc/init.d/UTMStackCollector && \
(systemctl daemon-reload 2>/dev/null || true) && \
echo 'UTMStack Collector uninstalled successfully'"`;
}


getUninstallCommandRedHat(installerName: string): string {
return `sudo bash -c "/opt/utmstack-collector/${installerName} uninstall && \
(systemctl stop UTMStackCollector 2>/dev/null || true) && \
(systemctl disable UTMStackCollector 2>/dev/null || true) && \
rm -rf /opt/utmstack-collector && \
rm -f /etc/systemd/system/UTMStackCollector.service && \
systemctl daemon-reload && \
echo 'UTMStack Collector uninstalled successfully'"`;
}
}