通信协议

由iLogtail社区联合哔哩哔哩共同建设。服从HTTP/HTTPS协议。

通用参数

ip 和 port 为 ConfigServer 的 ip 和接收端口,默认为127.0.0.1和8899。

API 响应规范

数据的发送及接收均为 protocol buffer 格式,参见源代码中的 config_server/protocol 文件夹(v1.0)。

在调用API接口过程中,若返回HTTP状态码为 200,则表示请求成功,若返回HTTP状态码为其他,例如404等,则表示调用API接口失败。服务端会返回请求响应信息如下。code为响应码,表示请求成功/失败的类型;message 是响应信息,包含详细的请求成功信息/失败说明。

{
  "code" : <Code>,
  "message" : <Message>
}

主要响应码如下所示:

通信时常见数据类型说明

Agent

通信传输中的采集 Agent 信息。

AgentAttributes

AgentGroup

通信传输中的 AgentGroup 信息。

AgentGroupTag

通信传输中的 AgentGroup 的 Tag 信息。

CheckStatus(枚举类型)

拉取配置文件更新时返回的更新状态。

Command

Agent 从 ConfigServer 接收到的指令。

ConfigCheckResult

ConfigServer 返回给 Agent 的配置文件更新信息。

ConfigDetail

通信传输中的采集 Config 的信息。

ConfigInfo

Agent 向 ConfigServer 请求时携带的配置文件信息。

ConfigType(枚举类型)

配置文件的类型。

RespCode(枚举类型)

通信时返回的状态码。

接口说明

以API的形式对外提供统一的管控。总体分为两大类:

  • 用户API

    • AgentGroup 创建/修改/删除/查看

    • 采集配置 创建/修改/删除/查看

    • 采集配置与 AgentGroup 绑定/解绑

  • Agent API

    • Agent心跳

    • 采集配置获取

用户API: AgentGroup 创建/修改/删除/查看

ip:port/User/CreateAgentGroup

  • 功能:新建 AgentGroup

  • 请求方式:POST

  • 参数:

  • 返回值: 无

ip:port/User/UpdateAgentGroup

  • 功能:修改已有的 AgentGroup 的信息

  • 请求方式:PUT

  • 参数:

  • 返回值: 无

ip:port/User/DeleteAgentGroup/

  • 功能:删除已建立的 AgentGroup

  • 请求方式:DELETE

  • 参数:

  • 返回值: 无

ip:port/User/GetAgentGroup/

  • 功能:查看 AgentGroup 的信息

  • 请求方式:GET

  • 参数:

  • 返回值:

ip:port/User/ListAgentGroups/

  • 功能:获取所有的 AgentGroup 列表

  • 请求方式:GET

  • 参数:无

  • 返回值:

用户API:采集配置 创建/修改/删除/查看

ip:port/User/CreateConfig/

  • 功能:导入本地 Config

  • 请求方式:POST

  • 参数:

  • 返回值: 无

ip:port/User/UpdateConfig/

  • 功能:修改已有的 Config 的信息

  • 请求方式:PUT

  • 参数:

  • 返回值: 无

ip:port/User/DeleteConfig/

  • 功能:删除已保存的 Config

  • 请求方式:DELETE

  • 参数:

  • 返回值: 无

ip:port/User/GetConfig/

  • 功能:查看指定的 Config 的信息

  • 请求方式:GET

  • 参数:

  • 返回值:

ip:port/User/ListConfigs/

  • 功能:获取所有的 Config 列表

  • 请求方式:GET

  • 参数:无

  • 返回值:

用户API:采集配置与 AgentGroup 绑定/解绑

ip:port/User/ApplyConfigToAgentGroup/

  • 功能:向 AgentGroup 中添加 Config

  • 请求方式:PUT

  • 参数:

  • 返回值: 无

ip:port/User/RemoveConfigFromAgentGroup/

  • 功能:删除 AgentGroup 中的 Config

  • 请求方式:DELETE

  • 参数:

  • 返回值: 无

ip:port/User/GetAppliedConfigsForAgentGroup/

  • 功能:查看 AgentGroup 中的 Config 列表

  • 请求方式:GET

  • 参数:

  • 返回值:

ip:port/User/GetAppliedAgentGroups/

  • 功能:查看 Config 关联的 AgentGroup 列表

  • 请求方式:GET

  • 参数:

  • 返回值:

ip:port/User/ListAgents/

  • 功能:获取 AgentGroup 中 Agent 列表

  • 请求方式:GET

  • 参数:

  • 返回值:

Agent API:写入心跳

ip:port/Agent/HeartBeat/

  • 功能:Agent 向 ConfigServer发送心跳

  • 请求方式:POST

  • 参数:

  • 返回值:

Agent API:根据 Agent 获取采集配置(含变更信息)

ip:port/Agent/FetchPipelineConfig/

  • 功能:Agent 向 ConfigServer 发送已有的采集配置列表,获取更新

  • 请求方式:POST

  • 参数:

  • 返回值:

ip:port/Agent/FetchAgentConfig/

  • 功能:Agent 向 ConfigServer 发送已有的运行配置列表,获取更新

  • 请求方式:POST

  • 参数:

  • 返回值:

Last updated