状态

状态

GET /api/v4/stats

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

Path Parameters: 无

Success Response Body (JSON):

Name Type Description
code Integer 0
data Array of Objects 各节点上的状态数据列表
data[0].node String 节点名称
data[0].stats Array 状态数据,详见下面的 stats

stats:

Name Type Description
connections.count Integer 当前连接数量
connections.max Integer 连接数量的历史最大值
channels.count Integer 即 sessions.count
channels.max Integer 即 session.max
sessions.count Integer 当前会话数量
sessions.max Integer 会话数量的历史最大值
topics.count Integer 当前主题数量
topics.max Integer 主题数量的历史最大值
suboptions.count Integer 即 subscriptions.count
suboptions.max Integer 即 subscriptions.max
subscribers.count Integer 当前订阅者数量
subscribers.max Integer 订阅者数量的历史最大值
subscriptions.count Integer 当前订阅数量,包含共享订阅
subscriptions.max Integer 订阅数量的历史最大值
subscriptions.shared.count Integer 当前共享订阅数量
subscriptions.shared.max Integer 共享订阅数量的历史最大值
routes.count Integer 当前路由数量
routes.max Integer 路由数量的历史最大值
retained.count Integer 当前保留消息数量
retained.max Integer 保留消息的历史最大值

Examples:

$ curl -i --basic -u admin:public -X GET "http://localhost:8081/api/v4/stats"

{"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):

Name Type Description
code Integer 0
data Array of Objects 各节点上的状态数据列表,详见 GET /api/v4/stats

Examples:

$ curl -i --basic -u admin:public -X GET "http://localhost:8081/api/v4/nodes/emqx@127.0.0.1/stats"

{"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}