更新时间:2025-04-29 GMT+08:00
分享

安装Agent

本章节主要介绍如何在已有裸金属服务器实例中手动安装Agent,实现主机监控。您需要完成以下步骤:

  1. 配置委托:对该区域下裸金属服务器安装的Agent做委托授权,委托方法请参考如何配置委托?
  2. 添加域名解析地址:在裸金属服务器“/etc/resolv.conf”文件中添加各区域域名解析地址。
  3. 配置安全组:用于下载Telescope包、发送指标数据、采集日志等。
  4. 操作步骤:手动为裸金属服务器安装Agent,实现主机监控。

添加域名解析地址

  1. 使用root帐号,登录裸金属服务器。
  2. 输入vi /etc/resolv.conf,打开“/etc/resolv.conf”文件。
  3. 在文件中添加“nameserver 100.125.1.250”和“nameserver 100.125.21.250”,如图1所示。
    图1 添加域名解析地址

    不同区域nameserver不同,如下所示:

    华北-北京一:100.125.1.250,100.125.21.250

    华北-北京四:100.125.1.250,100.125.129.250

    华东-上海一:100.125.1.250,100.125.64.250

    华南-广州:100.125.1.250,100.125.136.29

    中国-香港:100.125.1.250,100.125.3.250

    亚太-曼谷:100.125.1.250,100.125.3.250

    拉美-圣地亚哥:100.125.1.250

  4. 按“Esc”,输入:wq保存设置。

配置安全组

  1. 在裸金属服务器详情页面,单击“安全组”页签。
  2. 单击图标展开安全组详情,其中包含所配置的安全组规则。
  3. 在规则列表右上方单击安全组ID,跳转至“安全组”页面。
  4. 在操作列单击“配置规则”,在“出方向规则”页签下单击“添加规则”,按表1添加规则。
    表1 安全组规则

    方向

    协议

    端口

    目的地址

    说明

    出方向

    TCP

    80

    100.125.0.0/16

    用于从OBS桶下载Agent包到BMS中、获取BMS的元数据信息与鉴权信息。

    出方向

    TCP、UDP

    53

    100.125.0.0/16

    用于DNS解析域名,下载Agent时解析OBS地址、发送监控数据时解析云监控服务Endpoint地址。

    出方向

    TCP

    443

    100.125.0.0/16

    采集监控数据到云监控服务端。

操作步骤

  1. 使用root帐号,登录BMS。
  2. 执行以下命令,安装Agent。

    华北-北京一:

    cd /usr/local && curl -k -O https://obs.cn-north-1.myhuaweicloud.com/uniagent-cn-north-1/script/agent_install.sh && bash agent_install.sh

    华北-北京四:

    cd /usr/local && curl -k -O https://obs.cn-north-4.myhuaweicloud.com/uniagent-cn-north-4/script/agent_install.sh && bash agent_install.sh

    华南-广州:

    cd /usr/local && curl -k -O https://obs.cn-south-1.myhuaweicloud.com/uniagent-cn-south-1/script/agent_install.sh && bash agent_install.sh

    华南-广州-友好用户环境:

    cd /usr/local && wget https://telescope-cn-south-4.obs.cn-south-4.myhuaweicloud.com/scripts/agentInstall.sh && chmod 755 agentInstall.sh && ./agentInstall.sh

    华南-深圳:

    cd /usr/local && curl -k -O https://obs.cn-south-2.myhuaweicloud.com/uniagent-cn-south-2/script/agent_install.sh && bash agent_install.sh

    华东-上海一:

    cd /usr/local && curl -k -O https://obs.cn-east-3.myhuaweicloud.com/uniagent-cn-east-3/script/agent_install.sh && bash agent_install.sh

    华东-上海二:

    cd /usr/local && curl -k -O https://obs.cn-east-2.myhuaweicloud.com/uniagent-cn-east-2/script/agent_install.sh && bash agent_install.sh

    西南-贵阳一:

    cd /usr/local && curl -k -O https://obs.cn-southwest-2.myhuaweicloud.com/uniagent-cn-southwest-2/script/agent_install.sh && bash agent_install.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

    亚太-曼谷:

    cd /usr/local && curl -k -O https://obs.ap-southeast-2.myhuaweicloud.com/uniagent-ap-southeast-2/script/agent_install.sh && bash agent_install.sh

    亚太-新加坡:

    cd /usr/local && curl -k -O https://obs.ap-southeast-3.myhuaweicloud.com/uniagent-ap-southeast-3/script/agent_install.sh && bash agent_install.sh

    亚太-雅加达:

    cd /usr/local && curl -k -O https://obs.ap-southeast-4.myhuaweicloud.com/uniagent-ap-southeast-4/script/agent_install.sh && bash agent_install.sh

    非洲-约翰内斯堡:

    cd /usr/local && curl -k -O https://obs.af-south-1.myhuaweicloud.com/uniagent-af-south-1/script/agent_install.sh && bash agent_install.sh

    拉美-圣地亚哥:

    cd /usr/local && curl -k -O https://obs.la-south-2.myhuaweicloud.com/uniagent-la-south-2/script/agent_install.sh && bash agent_install.sh

    拉美-圣保罗一:

    cd /usr/local && wget https://telescope-sa-brazil-1.obs.myhuaweicloud.com/scripts/agentInstall.sh && chmod 755 agentInstall.sh && ./agentInstall.sh

    拉美-墨西哥城一:

    cd /usr/local && wget https://telescope-na-mexico-1.obs.myhuaweicloud.com/scripts/agentInstall.sh && chmod 755 agentInstall.sh && ./agentInstall.sh

    拉美-墨西哥城二:

    cd /usr/local && curl -k -O https://uniagent-la-north-2.obs.la-north-2.myhuaweicloud.com/script/agent_install.sh && bash agent_install.sh
    当回显如下图所示时,说明Agent安装成功。
    图2 Agent安装成功
  3. 安装完成后,请手动配置Agent(Linux,可选)完成Agent的配置。
  4. 执行如下命令,清除安装脚本。

    if [[ -f /usr/local/uniagent/extension/install/telescope/bin/telescope ]]; then rm /usr/local/agent_install.sh; else rm /usr/local/agentInstall.sh; fi

相关文档