卸载 Elastic Agent
Elastic Stack Serverless Security
要从主机卸载 Elastic Agent,请从其运行目录运行 uninstall
命令。有关更多信息,请参阅Fleet 和 Elastic Agent 文档。
如果在主机的 Agent 策略上启用了Agent 篡改保护,则需要在使用 --uninstall-token
标志的命令中包含卸载令牌。您可以在 Agent 策略上找到卸载令牌。 或者,在导航菜单中或使用全局搜索字段找到 Fleet,然后选择 Uninstall tokens。
例如,要在 macOS 或 Linux 主机上卸载 Elastic Agent
sudo elastic-agent uninstall --uninstall-token 12345678901234567890123456789012
如果您有多个受篡改保护的 Elastic Agent 策略,您可能希望在单个命令中提供多个卸载令牌。有两种方法可以做到这一点
--uninstall-token
命令可以接收多个卸载令牌,用逗号分隔,没有空格。sudo elastic-agent uninstall -f --uninstall-token 7b3d364db8e0deb1cda696ae85e42644,a7336b71e243e7c92d9504b04a774266
--uninstall-token
的参数也可以是文本文件的路径,每个卸载令牌一行。注意您必须使用完整的文件路径,否则可能找不到该文件。
sudo elastic-agent uninstall -f --uninstall-token /tmp/tokens.txt
在本例中,
tokens.txt
将包含7b3d364db8e0deb1cda696ae85e42644 a7336b71e243e7c92d9504b04a774266
只有在卸载 Elastic Agent 不成功时,才可以使用这些命令从主机卸载 Elastic Endpoint。
Windows
cd %TEMP%
copy "c:\Program Files\Elastic\Endpoint\elastic-endpoint.exe" elastic-endpoint.exe
.\elastic-endpoint.exe uninstall
del .\elastic-endpoint.exe
macOS
cd /tmp
cp /Library/Elastic/Endpoint/elastic-endpoint elastic-endpoint
sudo ./elastic-endpoint uninstall
rm elastic-endpoint
Linux
cd /tmp
cp /opt/Elastic/Endpoint/elastic-endpoint elastic-endpoint
sudo ./elastic-endpoint uninstall
rm elastic-endpoint