统计指标
GET /api/v4/topic-metrics
返回所有主题统计指标数据。
Path Parameters: 无
Success Response Body (JSON):
Name | Type | Description |
---|---|---|
code | Integer | 0 |
data | Array of Objects | 各节点上的统计指标列表 |
data[0].topic | String | 主题名 |
data[0].metrics | Object | 主题统计指标数据,详见下面的 metrics: |
metrics:
Name | Type | Description |
---|---|---|
messages.qos2.out.rate | Integer | QoS 2 消息 5 秒内平均发送速率 |
messages.qos2.out.count | Integer | QoS 2 消息发送数量统计 |
messages.qos2.in.rate | Integer | QoS 2 消息 5 秒内平均接收速率 |
messages.qos2.in.count | Integer | QoS 2 消息接收数量统计 |
messages.qos1.out.rate | Integer | QoS 1 消息 5 秒内平均发送速率 |
messages.qos1.out.count | Integer | QoS 1 消息发送数量统计 |
messages.qos1.in.rate | Integer | QoS 1 消息 5 秒内平均接收速率 |
messages.qos1.in.count | Integer | QoS 1 消息接收数量统计 |
messages.qos0.out.rate | Integer | QoS 0 消息 5 秒内平均发送速率 |
messages.qos0.out.count | Integer | QoS 0 消息发送数量统计 |
messages.qos0.in.rate | Integer | QoS 0 消息 5 秒内平均接收速率 |
messages.qos0.in.count | Integer | QoS 0 消息接收数量统计 |
messages.out.rate | Integer | MQTT 消息 5 秒内平均发送速率 |
messages.out.count | Integer | MQTT 消息发送数量统计 |
messages.in.rate | Integer | MQTT 消息 5 秒内平均接收速率 |
messages.in.count | Integer | MQTT 消息接收数量统计 |
messages.dropped.rate | Integer | MQTT 消息 5 秒内平均丢弃速率 |
messages.dropped.count | Integer | MQTT 消息丢弃数量统计 |
Examples:
$ curl -i --basic -u admin:public -X GET "http://localhost:8081/api/v4/topic-metrics"
{"data":[],"code":0}
$ curl -i --basic -u admin:public -X POST "http://localhost:8081/api/v4/topic-metrics" -d '{"topic":"a/b/c"}'
{"code":0}
$ curl -i --basic -u admin:public -X GET "http://localhost:8081/api/v4/topic-metrics"
{"data":[{"topic":"a/b/c","metrics":{"messages.qos2.out.rate":0.0,"messages.qos2.out.count":0,"messages.qos2.in.rate":0.0,"messages.qos2.in.count":0,"messages.qos1.out.rate":0.0,"messages.qos1.out.count":0,"messages.qos1.in.rate":0.0,"messages.qos1.in.count":0,"messages.qos0.out.rate":0.0,"messages.qos0.out.count":0,"messages.qos0.in.rate":0.0,"messages.qos0.in.count":0,"messages.out.rate":0.0,"messages.out.count":0,"messages.in.rate":0.0,"messages.in.count":0,"messages.dropped.rate":0.0,"messages.dropped.count":0}}],"code":0}
GET /api/v4/topic-metrics/{topic}
返回指定主题的统计指标数据。
Path Parameters: 无
Success Response Body (JSON):
Name | Type | Description |
---|---|---|
code | Integer | 0 |
data | Object | 主题统计指标数据,详见下面的 data: |
data:
Name | Type | Description |
---|---|---|
messages.qos2.out.rate | Integer | QoS 2 消息 5 秒内平均发送速率 |
messages.qos2.out.count | Integer | QoS 2 消息发送数量统计 |
messages.qos2.in.rate | Integer | QoS 2 消息 5 秒内平均接收速率 |
messages.qos2.in.count | Integer | QoS 2 消息接收数量统计 |
messages.qos1.out.rate | Integer | QoS 1 消息 5 秒内平均发送速率 |
messages.qos1.out.count | Integer | QoS 1 消息发送数量统计 |
messages.qos1.in.rate | Integer | QoS 1 消息 5 秒内平均接收速率 |
messages.qos1.in.count | Integer | QoS 1 消息接收数量统计 |
messages.qos0.out.rate | Integer | QoS 0 消息 5 秒内平均发送速率 |
messages.qos0.out.count | Integer | QoS 0 消息发送数量统计 |
messages.qos0.in.rate | Integer | QoS 0 消息 5 秒内平均接收速率 |
messages.qos0.in.count | Integer | QoS 0 消息接收数量统计 |
messages.out.rate | Integer | MQTT 消息 5 秒内平均发送速率 |
messages.out.count | Integer | MQTT 消息发送数量统计 |
messages.in.rate | Integer | MQTT 消息 5 秒内平均接收速率 |
messages.in.count | Integer | MQTT 消息接收数量统计 |
messages.dropped.rate | Integer | MQTT 消息 5 秒内平均丢弃速率 |
messages.dropped.count | Integer | MQTT 消息丢弃数量统计 |
Examples:
$ curl -i --basic -u admin:public -X GET "http://localhost:8081/api/v4/topic-metrics/a%2Fb%2Fc"
{"data":{"messages.qos2.out.rate":0.0,"messages.qos2.out.count":0,"messages.qos2.in.rate":0.0,"messages.qos2.in.count":0,"messages.qos1.out.rate":0.0,"messages.qos1.out.count":0,"messages.qos1.in.rate":0.0,"messages.qos1.in.count":0,"messages.qos0.out.rate":0.0,"messages.qos0.out.count":0,"messages.qos0.in.rate":0.0,"messages.qos0.in.count":0,"messages.out.rate":0.0,"messages.out.count":0,"messages.in.rate":0.0,"messages.in.count":0,"messages.dropped.rate":0.0,"messages.dropped.count":0},"code":0}
POST /api/v4/topic-metrics
开启对指定主题的指标统计。
Parameters (json):
Name | Type | Required | Default | Description |
---|---|---|---|---|
topic | String | Required | MQTT 主题名 |
Success Response Body (JSON):
Name | Type | Description |
---|---|---|
code | Integer | 0 |
Examples:
开启对 a/b/c
主题的指标统计
$ curl -i --basic -u admin:public -X POST "http://localhost:8081/api/v4/topic-metrics" -d '{"topic":"a/b/c"}'
{"code":0}
DELETE /api/v4/topic-metrics/{topic}
关闭对指定主题的指标统计。
Path Parameters: 无
Success Response Body (JSON):
Name | Type | Description |
---|---|---|
code | Integer | 0 |
Examples:
关闭对 a/b/c
主题的指标统计
$ curl -i --basic -u admin:public -X DELETE "http://localhost:8081/api/v4/topic-metrics/a%2Fb%2Fc"
{"code":0}
DELETE /api/v4/topic-metrics
关闭所有主题的指标统计。
Path Parameters: 无
Success Response Body (JSON):
Name | Type | Description |
---|---|---|
code | Integer | 0 |
Examples:
关闭所有主题的指标统计
$ curl -i --basic -u admin:public -X DELETE "http://localhost:8081/api/v4/topic-metrics"
{"code":0}