文档首页/ 云监控服务 CES/ 常见问题/ 产品使用/ 主机监控/ 如何通过修改配置文件调整Agent资源消耗阈值?
更新时间:2025-04-29 GMT+08:00

如何通过修改配置文件调整Agent资源消耗阈值?

本章节介绍如何通过修改配置文件调整Agent资源消耗阈值,具体操作步骤如下:

  1. 使用root账号,登录Agent不上报数据的ECS或BMS。
  2. 修改配置文件conf.json。
    1. 执行以下命令,切换至Agent安装路径的bin下。
      Windows系统:
      cd C:\Program Files\uniagent\extension\install\telescope
      Linux系统:
      cd /usr/local/uniagent/extension/install/telescope/bin
    2. 执行以下命令,打开配置文件conf.json
      vi conf.json
    3. 在conf.json文件中,添加如下参数,具体参数说明请参见:
      {
          "cpu_first_pct_threshold": xx,
          "memory_first_threshold": xxx,
          "cpu_second_pct_threshold": xx,
          "memory_second_threshold": xxx
      }
      表1 conf.json文件配置参数说明

      参数

      说明

      参数值查看方式

      cpu_first_pct_threshold

      第一阈值(CPU),默认值为10,单位为%。

      Agent的CPU使用率和内存使用率查询方法:

      • Linux:

        top -p telescope的PID

      • Windows:

        在任务管理器中查看Agent进程详情。

      memory_first_threshold

      第一阈值(内存),默认值为209715200(200MB),单位为Byte。

      cpu_second_pct_threshold

      第二阈值(CPU),默认值为30,单位为%。

      memory_second_threshold

      第二阈值(内存),默认值为734003200(700MB),单位为Byte。

    4. 执行如下命令,保存并退出conf.json文件:
      :wq
  3. 修改配置文件manifest.json。
    1. 执行以下命令,切换至manifest.json文件路径下
      Windows系统:
      cd C:\Program Files\uniagent\extension\holder\telescope
      Linux系统:
      cd /usr/local/uniagent/extension/holder/telescope
    2. 执行以下命令,打开配置文件manifest.json:
      vi manifest.json
    3. 在manifest.json文件中,修改配置文件resourceLimit中的参数:mem和cpuUsage,共计三组。其他参数请不要修改。
      [
      	{
      		"arch": "amd64",
      		...
      		"resourceLimit": {
      			"mem": 200,
      			"cpuUsage": 10
      		}
      	},
      	{
      		"arch": "arm64",
      		...
      		"resourceLimit": {
      			"mem": 200,
      			"cpuUsage": 10
      		}
      	},
      	{
      		"arch": "amd64",
      		"os": "linux",
      		...
      		"resourceLimit": {
      			"mem": 200,
      			"cpuUsage": 10
      		}
      	}
      ]
      表2 manifest.json文件配置参数说明

      参数

      说明

      "resourceLimit": {

      "mem": 200,

      "cpuUsage": 10

      }

      mem:内存阈值,默认值为200,单位为MB;

      cpuUsage:CPU阈值,默认值为10,单位为%。

    4. 执行如下命令,保存并退出manifest.json文件:
      :wq
  4. 请执行如下命令,重启Agent:
    • Windows系统
      1. 在“C:\Program Files\uniagent\extension\install\telescope”路径下,先双击执行shutdown.bat脚本,停止Agent,再执行start.bat脚本,启动Agent。
      2. 在“C:\Program Files\uniagent\script”路径下,先双击执行shutdown.bat脚本,停止Agent,再执行start.bat脚本,启动Agent。
    • Linux系统
      /usr/local/uniagent/bin/uniagent stop
      /usr/local/uniagent/bin/uniagent start
      /usr/local/uniagent/extension/install/telescope/telescoped restart