一、了解华为云主机监控
华为云为使用自家云产品的用户,提供了基于资源层面的监控告警服务,通过使用监控告警可以全面地了解资源使用率、应用程序性能和运行状况,行云管家能够通过API的方式,将主机的相关监控数据同步过来,用户可直接在行云管家中获得华为云的监控数据。
您可以继续阅读下文内容,也可以到华为云官网翻阅有关云监控告警功能的进一步介绍:华为云主机监控功能官网介绍(推荐直接查看官方指引)
二、如何启用华为云主机监控服务
默认情况下,华为云的所有资源都不会启动开启监控告警,用户需要手动启用。如果您需要了解这方面的操作,请参照以下指引进行:
三、安装配置Linux版Agent
3.1、添加DNS服务解析
(1)使用root账号,登录ECS或BMS;
(2)添加域名解析地址至resolv.conf文件;
a)输入“vi /etc/resolv.conf
”,打开文件;
b)在文件中添加“nameserver 100.125.1.250”(如下所示),保存设置;
- 注意:不同区域nameserver不同,如下所示:
区域 DNS 华北-北京一 100.125.1.250,100.125.21.250 华北-北京四 100.125.1.250,100.125.129.250 西南-贵阳一 100.125.1.250, 100.125.129.250 华东-上海一 100.125.1.250,100.125.64.250 华东-上海二 100.125.17.29,100.125.135.29 华南-广州 100.125.1.250,100.125.136.29 亚太-香港 100.125.1.250,100.125.3.250 亚太-曼谷 100.125.1.250 亚太-新加坡 100.125.1.250,100.125.128.250
非洲-约翰内斯堡 100.125.1.250 拉美-圣地亚哥 100.125.1.250 拉美-圣保罗一 100.125.1.22
(3)在华为云控制台修改子网DNS服务器地址;
a)在华为云控制台左上角选择主机/服务器所在的区域后,在“服务列表”里进入“弹性云服务器ECS”,如图单击ECS名称查看详情;
b)如图在“云服务器信息”里点击“虚拟私有云”进入“虚拟私有云”界面;
c)在“名称”列表中,单击该“虚拟私有云”;
d)在“子网”列表中,单击“修改”。修改“DNS服务器地址”例如是“100.125.1.250,100.125.129.250”。如下图所示:
- 注意:如图,subnet-4ba8为该ECS的子网,DNS服务器地址与1.2中的nameserver保持一致。
(4)在“虚拟私有云”对应的“安全组”页面,按下表所示添加规则。
3.2、安装Agent
(1)使用root账号,登录ECS或BMS;
(2)选择Agent安装包下载路径,切换至该目录下,以/usr/local为例,执行以下命令:
cd /usr/local
(3)根据区域选择好相应的Agent下载地址,执行以下命令,下载Agent,以华北-北京一为例:
-
华北-北京一:https://obs.myhwclouds.com/telescope/agent/telescope_linux_amd64.tar.gz
-
华北-北京一:https://obs.cn-north-1.myhuaweicloud.com/uniagent-cn-north-1/package/uniagent_linux_amd64.tar.gz
-
华北-北京四:https://obs.cn-north-4.myhuaweicloud.com/uniagent-cn-north-4/package/uniagent_linux_amd64.tar.gz
-
西南-贵阳一:https://telescope-cn-southwest-2.obs.myhuaweicloud.com/agent/telescope_linux_amd64.tar.gz
-
华南-广州:https://obs.cn-south-1.myhuaweicloud.com/uniagent-cn-south-1/package/uniagent_linux_amd64.tar.gz
-
华东-上海二:https://obs.cn-east-2.myhuaweicloud.com/uniagent-cn-east-2/package/uniagent_linux_amd64.tar.gz
-
华东-上海一:https://obs.cn-east-3.myhuaweicloud.com/uniagent-cn-east-3/package/uniagent_linux_amd64.tar.gz
-
亚太-香港:https://telescope-ap-southeast-1.obs.ap-southeast-1.myhuaweicloud.com/agent/telescope_linux_amd64.tar.gz
-
亚太-曼谷:https://telescope-ap-southeast-2.obs.ap-southeast-2.myhuaweicloud.com/agent/telescope_linux_amd64.tar.gz
-
亚太-新加坡:https://telescope-ap-southeast-3.obs.ap-southeast-3.myhuaweicloud.com/agent/telescope_linux_amd64.tar.gz
-
非洲-约翰内斯堡:https://telescope-af-south-1.obs.af-south-1.myhuaweicloud.com/agent/telescope_linux_amd64.tar.gz
-
拉美-圣地亚哥:https://telescope-la-south-2.obs.la-south-2.myhuaweicloud.com/agent/telescope_linux_amd64.tar.gz
-
拉美-圣保罗一:https://telescope-sa-brazil-1.obs.sa-brazil-1.myhuaweicloud.com/agent/telescope_linux_amd64.tar.gz
wget http://obs.myhwclouds.com/telescope/agent/telescope_linux_amd64.tar.gz
(4)执行以下命令,解压安装包:
tar -zxvf telescope_linux_amd64.tar.gz
(5)执行以下命令,切换至Agent安装包解压目录下;
cd telescope_linux_amd64
(6)执行以下命令,开始安装Agent:
chmod 755 install.sh; ./install.sh
当出现以下输出内容时,代表Agent安装成功:
3.3、配置Agent
用户成功安装Agent插件后,需要修改相关配置文件,用于上报监控指标和心跳数据;
(1)使用root账号,登录ECS;
(2)执行以下命令,切换至Agent安装路径的bin下:
cd /usr/local/telescope/bin
(3)修改配置文件conf.json:
a)执行以下命令,打开配置文件conf.json:
vi conf.json
b)修改文件中的参数,具体参数请参见下表:
{ "InstanceId":"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx", "ProjectId": "b5b92ee0xxxxxxxxxxxxxxxxcab92396", "AccessKey": "QZ0XGJXFxxxxxxxxT65R", "SecretKey": "lEv2aXAGwxxxxxxxxxxxxxxxxxxxxF8t0Bf18Tn2", "RegionId": "cn-north-1" }
(4)修改云监控指标采集模块的配置文件conf_ces.json:
a)执行以下命令,打开公共配置文件conf_ces.json:
vi conf_ces.json
b)修改文件中的参数,具体参数请参见下表:
{ "Endpoint": "https://ces.cn-north-1.myhuaweicloud.com" }
四、安装配置Windows版Agent
4.1、添加DNS服务解析
请参照Linux版Agent配置第一步添加DNS服务解析进行配置。
4.2、下载Agent安装包
请根据云主机所在区域,将相应的Agent安装包下载云主机上:
-
华北-北京一:https://obs.cn-north-1.myhuaweicloud.com/uniagent-cn-north-1/package/uniagent_windows_amd64.zip
-
华北-北京四:https://obs.cn-north-4.myhuaweicloud.com/uniagent-cn-north-4/package/uniagent_windows_amd64.zip
-
西南-贵阳一:https://telescope-cn-southwest-2.obs.myhuaweicloud.com/agent/telescope_windows_amd64.zip
-
华南-广州:https://obs.cn-south-1.myhuaweicloud.com/uniagent-cn-south-1/package/uniagent_windows_amd64.zip
-
华东-上海二:https://obs.cn-east-2.myhuaweicloud.com/uniagent-cn-east-2/package/uniagent_windows_amd64.zip
-
华东-上海一:https://obs.cn-east-3.myhuaweicloud.com/uniagent-cn-east-3/package/uniagent_windows_amd64.zip
-
亚太-香港:https://telescope-ap-southeast-1.obs.ap-southeast-1.myhuaweicloud.com/agent/telescope_windows_amd64.zip
-
亚太-曼谷:https://telescope-ap-southeast-2.obs.ap-southeast-2.myhuaweicloud.com/agent/telescope_windows_amd64.zip
-
亚太-新加坡:https://telescope-ap-southeast-3.obs.ap-southeast-3.myhuaweicloud.com/agent/telescope_windows_amd64.zip
-
非洲-约翰内斯堡:https://telescope-af-south-1.obs.af-south-1.myhuaweicloud.com/agent/telescope_windows_amd64.zip
-
拉美-圣地亚哥:https://telescope-la-south-2.obs.la-south-2.myhuaweicloud.com/agent/telescope_windows_amd64.zip
-
拉美-圣保罗一:https://telescope-sa-brazil-1.obs.sa-brazil-1.myhuaweicloud.com/agent/telescope_windows_amd64.zip
4.3、配置Agent
(1)创建安装包存放目录(如D:\Agent),解压Agent安装包telescope_windows_amd64.zip到该目录下;
(2)双击执行install.bat脚本,安装并启动Agent。当界面显示Install service success时,说明Agent安装成功并启动;
(3)安装完成后,您可以选择进入主机监控界面,单节需要配置的主机所在行的"插件状态"列的"配置异常",在弹出页面上,单击"一键修复",完成配置Agent。