Topic Tree REST API
This page describes how to use the Topic Tree REST API that is provided by the Management Center for the Pro Edition of Eclipse Mosquitto (MMC).
Before sending a command request, make sure that you have been authenticated.
Application Tokens REST API can be accessed by a user with any role.
Enable Topic Tree REST API
To enable the Topic Tree REST API, make sure you are using the Pro Edition of Mosquitto and that you have the feature enabled in your license. Also, ensure that your config file (specified with CEDALO_MC_PROXY_CONFIG
environmental variable or by default saved in management-center/config/config.json
) contains the following entry inside of the plugins
array:
{
"name": "system-status-rest-api"
}
On start-up, the Management Center will print a message that the system-status-rest-api
plugin is enabled and loaded into the console:
Loaded plugin: "cedalo_topictree_rest_api" (Cedalo Topic Tree REST API)
Without enabling the Topic Tree REST API, you won't be able to clear the topic tree using the button in the Web UI.
Topic Tree REST API
There are a few operations provided by the REST API for the Topic Tree:
GET /api/system/status
- get topic tree for all the brokers
Example of the reply:
{
"development-inspect": {
"_name": "development-inspect",
"$SYS": {
"broker": {
"version": "mosquitto version 2.5.3",
"uptime": "845837 seconds",
"clients": {
"total": "3",
"maximum": "5",
"inactive": "0",
"disconnected": "0",
"active": "3",
"connected": "3",
"expired": "0"
},
"load": {
"messages": {
"received": {
"1min": "10.64",
"5min": "9.88",
"15min": "9.05"
},
"sent": {
"1min": "87.69",
"5min": "85.96",
"15min": "83.45"
}
},
"publish": {
"dropped": {
"1min": "0.06",
"5min": "0.20",
"15min": "0.07"
},
"received": {
"1min": "2.30",
"5min": "1.89",
"15min": "1.09"
},
"sent": {
"1min": "66.31",
"5min": "65.20",
"15min": "63.03"
}
},
"bytes": {
"received": {
"1min": "375.80",
"5min": "312.36",
"15min": "186.36"
},
"sent": {
"1min": "16023.22",
"5min": "13589.75",
"15min": "8413.80"
}
},
"sockets": {
"1min": "59.56",
"5min": "59.61",
"15min": "59.63"
},
"connections": {
"1min": "0.06",
"5min": "0.20",
"15min": "0.07"
}
},
"messages": {
"stored": "53",
"received": "113774",
"sent": "3932194"
},
"store": {
"messages": {
"count": "53",
"bytes": "243"
}
},
"subscriptions": {
"count": "9"
},
"shared_subscriptions": {
"count": "0"
},
"retained messages": {
"count": "53"
},
"publish": {
"messages": {
"dropped": "0",
"received": "88",
"sent": "3818516"
},
"bytes": {
"received": "10896",
"sent": "23398338"
}
},
"bytes": {
"received": "251821",
"sent": "161467952"
},
"packet": {
"out": {
"count": "0",
"bytes": "0"
}
}
}
}
},
"Rocky": {
"_name": "Rocky",
"$SYS": {
"broker": {
"version": "mosquitto version 2.5.3",
"uptime": "2492699 seconds",
"clients": {
"total": "2",
"maximum": "4",
"inactive": "0",
"disconnected": "0",
"active": "2",
"connected": "2",
"expired": "0"
},
"load": {
"messages": {
"received": {
"1min": "357.11",
"5min": "355.98",
"15min": "355.44"
},
"sent": {
"1min": "452.61",
"5min": "445.40",
"15min": "447.64"
}
},
"publish": {
"dropped": {
"1min": "0.06",
"5min": "0.20",
"15min": "0.07"
},
"received": {
"1min": "4.41",
"5min": "2.30",
"15min": "1.39"
},
"sent": {
"1min": "86.96",
"5min": "79.24",
"15min": "80.44"
}
},
"bytes": {
"received": {
"1min": "20727.48",
"5min": "20421.88",
"15min": "20282.91"
},
"sent": {
"1min": "19602.97",
"5min": "11757.44",
"15min": "8441.63"
}
},
"sockets": {
"1min": "351.40",
"5min": "351.86",
"15min": "351.95"
},
"connections": {
"1min": "351.50",
"5min": "351.89",
"15min": "351.95"
}
},
"messages": {
"stored": "55",
"received": "14686273",
"sent": "31556220"
},
"store": {
"messages": {
"count": "55",
"bytes": "321"
}
},
"subscriptions": {
"count": "12"
},
"shared_subscriptions": {
"count": "0"
},
"retained messages": {
"count": "55"
},
"heap": {
"current": "18446744073706414976",
"maximum": "18446744073709551568"
},
"publish": {
"messages": {
"dropped": "0",
"received": "26662",
"sent": "16896853"
},
"bytes": {
"received": "3514369",
"sent": "141759469"
}
},
"bytes": {
"received": "834848274",
"sent": "809201999"
},
"packet": {
"out": {
"count": "0",
"bytes": "0"
}
}
}
}
},
...
}
DELETE /api
- delete topic tree
Response: 200 or error status code with a text/plain
If you try to get the topic tree (GET /api/system/status
) after you deleted and disabled it, you will see the following reply:
You can disable (stop) the topic tree on the settings page of the Web UI of the Management Center