数据遥测

数据遥测

PUT /api/v4/telemetry/status

启用或关闭数据遥测功能。

Path Parameters:

Parameters (json):

NameTypeRequiredDefaultDescription
enabledBooleanRequired是否启用

Success Response Body (JSON):

NameTypeDescription
codeInteger0
messageString仅在发生错误时返回,用于提供更详细的错误信息

Examples:

启用数据遥测功能:

  1. $ curl -i --basic -u admin:public -X PUT "http://localhost:8081/api/v4/telemetry/status" -d '{"enabled":true}'
  2. {"code":0}

GET /api/v4/telemetry/status

查询数据遥测功能是否启用。

Path Parameters:

Success Response Body (JSON):

NameTypeDescription
codeInteger0
dataArray of Objects遥测状态
data.enabledBoolean是否启用

Examples:

查询数据遥测功能是否启用:

  1. $ curl -i --basic -u admin:public -X GET "http://localhost:8081/api/v4/telemetry/status"
  2. {"data":{"enabled":true},"code":0}

GET /api/v4/telemetry/data

获取数据遥测功能上报的数据内容。

Path Parameters:

Success Response Body (JSON):

NameTypeDescription
codeInteger0
dataArray of Objects遥测数据
data.uuidString由时间戳、随机数组成的 UUID
data.up_timeIntegerBroker 启动时间,单位为毫秒
data.otp_versionStringBroker 使用的 Erlang OTP 版本
data.os_versionString操作系统版本
data.os_nameString操作系统名称
data.num_clientsInteger当前连接的客户端数量
data.nodes_uuidArray of Objects集群中其他节点的 UUID
data.nodes_uuid[0].uuidString集群中其他节点的 UUID
data.messages_sentInteger发送的消息数量
data.messages_receivedInteger接收的消息数量
data.licenseObjects证书信息
data.license.editionString版本
data.emqx_versionStringBroker 版本
data.active_pluginsArray of Objects启用插件列表
data.active_modulesArray of Objects启用模块列表

Examples:

获取数据遥测功能上报的数据内容:

  1. $ curl -i --basic -u admin:public -X GET "http://localhost:8081/api/v4/telemetry/data"
  2. {"data":{"uuid":"856916F6-ECC1-11EA-87C9-F9385C1F4A9C","up_time":553357,"otp_version":"22","os_version":"10.13.6","os_name":"Mac OS X","num_clients":0,"nodes_uuid":[],"messages_sent":0,"messages_received":0,"license":{"edition":"community"},"emqx_version":"dev-v4.2-rc.3","active_plugins":["emqx_telemetry","emqx_rule_engine","emqx_retainer","emqx_recon","emqx_management","emqx_dashboard"],"active_modules":["emqx_mod_presence","emqx_mod_rewrite","emqx_mod_acl_internal"]},"code":0}