Cluster Management
Cluster Management operations
Available API Paths
- /api/cluster-management/clusters
 - /api/cluster-management/status/clusters
 - /api/cluster-management/clusters/{clusterName}
 - /api/cluster-management/mqtt
 
Path: /api/cluster-management/clusters
Methods
GET
Retrieve a list of all clusters. Can be accessed by viewer, editor, admin, and monitoringViewer
Responses
| Status | Description | Response Content or Scheme | 
| 200 | An array of all clusters |  | 
Example
{
  "clustername": "promosquittoha3",
  "description": "Pro Mosquitto HA 3-Node Cluster",
  "nodes": [
    {
      "port": 7000,
      "nodeid": 1,
      "address": "111.111.5.1",
      "broker": "mosquitto1",
      "connection": {
        "url": "mqtt://111.111.5.1:1885"
      },
      "ha": {
        "clustername": "promosquittoha3",
        "uuid": "E4F345F8-6905-1ED4-16B9-0C9028761AE1",
        "nodes": [
          {
            "address": "111.111.5.2",
            "port": 7000,
            "nodeid": 2
          },
          {
            "address": "111.111.5.3",
            "port": 7000,
            "nodeid": 3
          },
          {
            "address": "111.111.5.1",
            "port": 7000,
            "nodeid": 1
          }
        ],
        "version": 1,
        "syncmode": "full"
      },
      "leader": true,
      "clustername": "promosquittoha3",
      "uuid": "E4F345F8-6905-1ED4-16B9-0C9028761AE1",
      "log_index": 96
    },
    {
      "port": 7000,
      "nodeid": 2,
      "address": "111.111.5.2",
      "broker": "mosquitto2",
      "connection": {
        "url": "mqtt://111.111.5.2:1885"
      },
      "ha": {
        "clustername": "promosquittoha3",
        "uuid": "E4F345F8-6905-1ED4-16B9-0C9028761AE1",
        "nodes": [
          {
            "address": "111.111.5.3",
            "port": 7000,
            "nodeid": 3
          },
          {
            "address": "111.111.5.1",
            "port": 7000,
            "nodeid": 1
          },
          {
            "address": "111.111.5.2",
            "port": 7000,
            "nodeid": 2
          }
        ],
        "version": 1,
        "syncmode": "full"
      },
      "leader": false,
      "clustername": "promosquittoha3",
      "uuid": "E4F345F8-6905-1ED4-16B9-0C9028761AE1"
    },
    {
      "port": 7000,
      "nodeid": 3,
      "address": "111.111.5.3",
      "broker": "mosquitto3",
      "connection": {
        "url": "mqtt://111.111.5.3:1885"
      },
      "ha": {
        "clustername": "promosquittoha3",
        "uuid": "E4F345F8-6905-1ED4-16B9-0C9028761AE1",
        "nodes": [
          {
            "address": "111.111.5.2",
            "port": 7000,
            "nodeid": 2
          },
          {
            "address": "111.111.5.1",
            "port": 7000,
            "nodeid": 1
          },
          {
            "address": "111.111.5.3",
            "port": 7000,
            "nodeid": 3
          }
        ],
        "version": 1,
        "syncmode": "full"
      },
      "leader": false,
      "clustername": "promosquittoha3",
      "uuid": "E4F345F8-6905-1ED4-16B9-0C9028761AE1"
    }
  ],
  "state": "active"
}
| Status | Description | Response Content or Scheme | 
| 401 | Access to resource is denied. User not authenticated (logged in) or session expired |  | 
| 403 | User does not have enough permissions to access the resource |  | 
| 404 | Plugin is not enabled or not found |  | 
| 410 | Requested entity does not exists or was removed |  | 
| 500 | An internal server error has occured |  | 
Path: /api/cluster-management/status/clusters
Methods
GET
Retrieve the status of all clusters. Can be accessed by viewer, editor, admin, and monitoringViewer
Responses
| Status | Description | Response Content or Scheme | 
| 200 | Object containing an array of cluster statuses |  | 
| 401 | Access to resource is denied. User not authenticated (logged in) or session expired |  | 
| 403 | User does not have enough permissions to access the resource |  | 
| 404 | Plugin is not enabled or not found |  | 
| 410 | Requested entity does not exists or was removed |  | 
| 500 | An internal server error has occured |  | 
Path: /api/cluster-management/clusters/{clusterName}
Methods
GET
Retrieve a specific cluster by its clustername. Can be accessed by viewer, editor, admin, and monitoringViewer
Parameters
| Name | Location | Type | Required | Description | 
|---|---|---|---|---|
| clusterName | path | string | true | Name of the cluster to retrieve | 
Responses
| Status | Description | Response Content or Scheme | 
| 200 | Object which represents a cluster with all it's nodes |  | 
| 401 | Access to resource is denied. User not authenticated (logged in) or session expired |  | 
| 403 | User does not have enough permissions to access the resource |  | 
| 404 | Plugin is not enabled or not found |  | 
| 410 | Requested entity does not exists or was removed |  | 
| 500 | An internal server error has occured |  | 
Path: /api/cluster-management/mqtt
Methods
POST
Send a command to a cluster node (commands get redirected to the leader) as defined in Mosquitto HA Cedalo documentation. Must be admin to access
Parameters
| Name | Location | Type | Required | Description | 
|---|---|---|---|---|
| body | body | undefined | true | Broker ID and command to send | 
Responses
| Status | Description | Response Content or Scheme | 
| 200 | Result from the cluster |  | 
| 400 | Input data invalid |  | 
| 401 | Access to resource is denied. User not authenticated (logged in) or session expired |  | 
| 403 | User does not have enough permissions to access the resource |  | 
| 404 | Plugin is not enabled or not found |  | 
| 410 | Requested entity does not exists or was removed |  | 
| 500 | An internal server error has occured |  |