连接信息(Connections)

获取集群连接信息

API 定义:

  1. GET api/v3/connections/

请求示例:

  1. GET api/v3/connections/?_page=1&_limit=10000

返回数据:

  1. {
  2. "code": 0,
  3. "data": [
  4. {
  5. "clean_start": true,
  6. "client_id": "mosquitto_mqtt",
  7. "conn_mod": "emqx_connection",
  8. "connected_at": "2019-04-29 11:05:01",
  9. "heap_size": 2586,
  10. "ipaddress": "127.0.0.1",
  11. "is_bridge": false,
  12. "keepalive": 60,
  13. "mailbox_len": 0,
  14. "node": "emqx@127.0.0.1",
  15. "peercert": "nossl",
  16. "port": 64899,
  17. "proto_name": "MQIsdp",
  18. "proto_ver": 3,
  19. "recv_cnt": 2,
  20. "recv_msg": 0,
  21. "recv_oct": 47,
  22. "recv_pkt": 2,
  23. "reductions": 3588,
  24. "send_cnt": 2,
  25. "send_msg": 0,
  26. "send_oct": 9,
  27. "send_pend": 0,
  28. "send_pkt": 2,
  29. "username": "undefined",
  30. "zone": "external"
  31. }
  32. ],
  33. "meta": {
  34. "page": 1,
  35. "limit": 10000,
  36. "count": 1
  37. }
  38. }

获取节点连接信息

API 定义:

  1. GET api/v3/nodes/${node}/connections/

请求示例:

  1. GET api/v3/nodes/emqx@127.0.0.1/connections/?_page=1&_limit=10000

返回数据:

  1. {
  2. "code": 0,
  3. "data": [
  4. {
  5. "clean_start": true,
  6. "client_id": "mosquitto_mqtt",
  7. "conn_mod": "emqx_connection",
  8. "connected_at": "2019-04-29 11:05:01",
  9. "heap_size": 610,
  10. "ipaddress": "127.0.0.1",
  11. "is_bridge": false,
  12. "keepalive": 60,
  13. "mailbox_len": 0,
  14. "node": "emqx@127.0.0.1",
  15. "peercert": "nossl",
  16. "port": 64899,
  17. "proto_name": "MQIsdp",
  18. "proto_ver": 3,
  19. "recv_cnt": 5,
  20. "recv_msg": 0,
  21. "recv_oct": 53,
  22. "recv_pkt": 5,
  23. "reductions": 6081,
  24. "send_cnt": 5,
  25. "send_msg": 0,
  26. "send_oct": 15,
  27. "send_pend": 0,
  28. "send_pkt": 5,
  29. "username": "undefined",
  30. "zone": "external"
  31. }
  32. ],
  33. "meta": {
  34. "page": 1,
  35. "limit": 10000,
  36. "count": 1
  37. }
  38. }

获取集群指定连接信息

API 定义:

  1. GET api/v3/connections/${clientid}

请求示例:

  1. GET api/v3/connections/mosquitto_mqtt

返回数据:

  1. {
  2. "code": 0,
  3. "data": [
  4. {
  5. "clean_start": true,
  6. "client_id": "mosquitto_mqtt",
  7. "conn_mod": "emqx_connection",
  8. "connected_at": "2019-04-29 11:05:01",
  9. "heap_size": 610,
  10. "ipaddress": "127.0.0.1",
  11. "is_bridge": false,
  12. "keepalive": 60,
  13. "mailbox_len": 0,
  14. "node": "emqx@127.0.0.1",
  15. "peercert": "nossl",
  16. "port": 64899,
  17. "proto_name": "MQIsdp",
  18. "proto_ver": 3,
  19. "recv_cnt": 8,
  20. "recv_msg": 0,
  21. "recv_oct": 59,
  22. "recv_pkt": 8,
  23. "reductions": 8560,
  24. "send_cnt": 8,
  25. "send_msg": 0,
  26. "send_oct": 21,
  27. "send_pend": 0,
  28. "send_pkt": 8,
  29. "username": "undefined",
  30. "zone": "external"
  31. }
  32. ]
  33. }

获取节点指定连接信息

API 定义:

  1. GET api/v3/nodes/${node}/connections/${clientid}

请求示例:

  1. GET api/v3/nodes/emqx@127.0.0.1/connections/mosquitto_mqtt

返回数据:

  1. {
  2. "code": 0,
  3. "data": [
  4. {
  5. "clean_start": true,
  6. "client_id": "mosquitto_mqtt",
  7. "conn_mod": "emqx_connection",
  8. "connected_at": "2019-04-29 11:05:01",
  9. "heap_size": 610,
  10. "ipaddress": "127.0.0.1",
  11. "is_bridge": false,
  12. "keepalive": 60,
  13. "mailbox_len": 0,
  14. "node": "emqx@127.0.0.1",
  15. "peercert": "nossl",
  16. "port": 64899,
  17. "proto_name": "MQIsdp",
  18. "proto_ver": 3,
  19. "recv_cnt": 14,
  20. "recv_msg": 0,
  21. "recv_oct": 71,
  22. "recv_pkt": 14,
  23. "reductions": 13534,
  24. "send_cnt": 14,
  25. "send_msg": 0,
  26. "send_oct": 33,
  27. "send_pend": 0,
  28. "send_pkt": 14,
  29. "username": "undefined",
  30. "zone": "external"
  31. }
  32. ]
  33. }

断开指定连接

API 定义:

  1. DELETE api/v3/connections/${clientid}

请求示例:

  1. DELETE api/v3/connections/mosquitto_mqtt

返回数据:

  1. {
  2. "code": 0
  3. }