• 沒有找到結果。

本章节指导用户根据各自业务需求管理Agent,可进行查看、启动、停止和卸载 Agent。

4.7.1 更新为新版本 Agent

约束限制

批量更新不支持跨区域执行。

操作步骤

1. 使用root账号,登录ECS。

2. 执行如下命令,确认使用Agent的版本。

if [[ -f /usr/local/uniagent/extension/install/telescope/bin/telescope ]];

then /usr/local/uniagent/extension/install/telescope/bin/telescope -v; elif [[ -f /usr/local/telescope/bin/telescope ]]; then echo "old agent"; else echo 0; fi

– 返回“old agent”,表示使用老版本Agent。

– 返回版本号,表示使用新版本Agent。

– 返回“0”,表示未安装Agent。

3. 在ECS的“/usr/local”目录下新建“iplist.txt”文件,按照iplist.txt格式整理好所 有需要更新Agent的ECS。

说明

iplist.txt格式为“IP地址,root用户密码”,每个保持一行,可添加多台ECS批量执行。

示例如下所示(样例中abcd为密码,请按实际值填写)。

192.168.1.1,abcd 192.168.1.2,abcd

4. 确定当前执行脚本ECS的架构。

if [[ $(arch) == "aarch64" ]]; then echo "

uniagent_patch_installer_arm64"; else echo "

uniagent_patch_installer_amd64";fi

5. 执行批量更新命令,请注意使用正确的Region ID替换下述命令中的“$

{Region_id}”,用4返回的结果替换“${batch_installer}”。

cd /usr/local && curl -k -O https://obs.${Region_id}.myhuaweicloud.com/

uniagent-${Region_id}/script/${batch_installer} && chmod +x $

{batch_installer} && ./${batch_installer} -c "cd /usr/local/telescope &&

bash uninstall.sh && cd /usr/local && curl -k -O https://obs.$ {Region_id}.myhuaweicloud.com/uniagent-${Region_id}/script/

agent_install.sh && bash agent_install.sh"

以中国-香港区域的x86执行机为例,命令示例如下:

cd /usr/local && curl -k -O https://obs.ap-southeast-1.myhuaweicloud.com/uniagent-ap-southeast-1/

script/uniagent_patch_installer_amd64 && chmod +x uniagent_patch_installer_amd64 && ./

uniagent_patch_installer_amd64 -c "cd /usr/local/telescope && bash uninstall.sh && cd /usr/local

&& curl -k -O https://obs.ap-southeast-1.myhuaweicloud.com/uniagent-ap-southeast-1/script/

agent_install.sh && bash agent_install.sh"

4.7.2 管理 Agent(Linux)

说明

查看、启动、停止、更新和卸载Agent需使用root用户。

查看 Agent 版本

1. 使用root账号,登录ECS。

2. 执行如下命令,确认使用Agent的版本。

if [[ -f /usr/local/uniagent/extension/install/telescope/bin/telescope ]];

then /usr/local/uniagent/extension/install/telescope/bin/telescope -v; elif [[ -f /usr/local/telescope/bin/telescope ]]; then echo "old agent"; else echo 0; fi

– 返回“old agent”,表示使用老版本Agent,请参考老版本操作指令。

– 返回版本号,表示使用新版本Agent,请参考新版本操作指令。

– 返回“0”,表示未安装Agent。

查看 Agent 状态(新版本)

以root用户登录ECS或BMS,执行以下命令,查看Agent状态。

/usr/local/uniagent/extension/install/telescope/telescoped status 当系统返回以下内容,则表示Agent为正常运行状态。

"Telescope process is running well."

启动 Agent(新版本)

执行以下命令,启动Agent。

/usr/local/uniagent/extension/install/telescope/telescoped start

重启 Agent(新版本)

执行以下命令查看telescope的PID。

ps -ef |grep telescope

强制关闭进程后等待3-5分钟telescope可实现自动重启,操作示例如图4-11所示。

kill -9 PID

4-11 重启 Agent

停止 Agent(新版本)

登录ECS或BMS,执行以下命令,停止Agent。

/usr/local/uniagent/extension/install/telescope/telescoped stop

卸载 Agent(新版本)

用户可手动卸载Agent插件,卸载后云监控服务将不再主动采集ECS或BMS秒级粒度的 监控数据。如需再次使用,请参考4.4 在ECS/BMS中安装配置Agent(Linux)重新安 装。

执行以下命令,即可卸载Agent。

cd /usr/local/uniagent/script/

./uninstall.sh

须知

重新安装Agent前,请手动清理之前的Agent安装包,新版安装包位于“/usr/local/

uniagent_install_amd64.sh”。

查看 Agent 状态(老版本)

以root用户登录ECS或BMS,执行以下命令,查看Agent状态。

service telescoped status

当系统返回以下内容,则表示Agent为正常运行状态。

"Active(running)"或"Telescope process is running well."

启动 Agent(老版本)

执行以下命令,启动Agent。

/usr/local/telescope/telescoped start

重启 Agent(老版本)

执行以下命令,重启Agent。

/usr/local/telescope/telescoped restart

停止 Agent(老版本)

登录ECS或BMS,执行以下命令,停止Agent。

service telescoped stop 说明

如果Telescope安装失败,可能会导致无法正常停止Agent,可通过执行以下命令进一步尝试;

/usr/local/telescope/telescoped stop

卸载 Agent(老版本)

执行以下命令,即可卸载Agent。

/usr/local/telescope/uninstall.sh

须知

用户可手动卸载Agent插件,卸载后云监控服务将不再主动采集ECS或BMS秒级粒度的 监控数据。如需再次使用,请参考4.4 在ECS/BMS中安装配置Agent(Linux)重新安 装。重新安装Agent前,请手动清理之前的Agent安装包。

4.7.3 管理 Agent(Windows)

老版本Agent默认安装路径为“C:\Program Files\telescope”。

新版本Agent默认安装路径为“C:\Program Files\uniagent\extension\install

\telescope”.

查看 Agent 状态

在任务管理器中查名为telescope的进程状态。

启动 Agent

在Agent安装包存放目录下,双击执行start.bat脚本,启动Agent。

停止 Agent

在Agent安装包存放目录下,双击执行shutdown.bat脚本,停止Agent。

卸载 Agent

在Agent安装包存放目录下,双击执行uninstall.bat脚本,卸载Agent。

须知

重新安装Agent前,请手动清理之前的Agent安装包。