状态

GET /api/v4/stats

返回集群下所有状态数据。

Path Parameters:

Success Response Body (JSON):

NameTypeDescription
codeInteger0
dataArray of Objects各节点上的状态数据列表
data[0].nodeString节点名称
data[0].statsArray状态数据,详见下面的 stats

stats:

NameTypeDescription
connections.countInteger当前连接数量
connections.maxInteger连接数量的历史最大值
channels.countIntegersessions.count
channels.maxIntegersession.max
sessions.countInteger当前会话数量
sessions.maxInteger会话数量的历史最大值
topics.countInteger当前主题数量
topics.maxInteger主题数量的历史最大值
suboptions.countIntegersubscriptions.count
suboptions.maxIntegersubscriptions.max
subscribers.countInteger当前订阅者数量
subscribers.maxInteger订阅者数量的历史最大值
subscriptions.countInteger当前订阅数量,包含共享订阅
subscriptions.maxInteger订阅数量的历史最大值
subscriptions.shared.countInteger当前共享订阅数量
subscriptions.shared.maxInteger共享订阅数量的历史最大值
routes.countInteger当前路由数量
routes.maxInteger路由数量的历史最大值
retained.countInteger当前保留消息数量
retained.maxInteger保留消息的历史最大值

Examples:

  1. $ curl -i --basic -u admin:public -X GET "http://localhost:8081/api/v4/stats"
  2. {"data":[{"stats":{"topics.max":0,"topics.count":0,"subscriptions.shared.max":0,"subscriptions.shared.count":0,"subscriptions.max":0,"subscriptions.count":0,"subscribers.max":0,"subscribers.count":0,"suboptions.max":0,"suboptions.count":0,"sessions.max":0,"sessions.count":0,"rules.max":0,"rules.count":0,"routes.max":0,"routes.count":0,"retained.max":3,"retained.count":3,"resources.max":0,"resources.count":0,"connections.max":0,"connections.count":0,"channels.max":0,"channels.count":0,"actions.max":5,"actions.count":5},"node":"emqx@127.0.0.1"}],"code":0}

GET /api/v4/nodes/{node}/stats

类似 GET /api/v4/stats,返回指定节点上的有状态数据。

Path Parameters:

Success Response Body (JSON):

NameTypeDescription
codeInteger0
dataArray of Objects各节点上的状态数据列表,详见 GET /api/v4/stats

Examples:

  1. $ curl -i --basic -u admin:public -X GET "http://localhost:8081/api/v4/nodes/emqx@127.0.0.1/stats"
  2. {"data":{"topics.max":0,"topics.count":0,"subscriptions.shared.max":0,"subscriptions.shared.count":0,"subscriptions.max":0,"subscriptions.count":0,"subscribers.max":0,"subscribers.count":0,"suboptions.max":0,"suboptions.count":0,"sessions.max":0,"sessions.count":0,"rules.max":0,"rules.count":0,"routes.max":0,"routes.count":0,"retained.max":3,"retained.count":3,"resources.max":0,"resources.count":0,"connections.max":0,"connections.count":0,"channels.max":0,"channels.count":0,"actions.max":5,"actions.count":5},"code":0}