Cluster API allows you to retrieve information on your cluster status. 

Current node is a primary master

When high availability is enabled, this endpoint tells you if you're querying the primary master or a secondary one.

GET /api/get/master

JSON Format

NameTypeDescription
primaryBooleantrue if this monitor is running on a primary node
secondaryBooleantrue if this monitor is running on a secondary node

Example response

{
  "primary": true,
  "secondary": false
}
JS

Retrieve all nodes

Retrieve all nodes running and down.

GET /api/get/nodes

JSON Format

NameTypeDescription
nodesDownArrayList of all nodes down or unattached
nodesUpArrayList of all nodes up and running

Example response

{
  "nodesDown": [],
  "nodesUp": [
    "ip-172-31-33-56.eu-west-1.compute.internal",
    "ip-172-31-33-12.eu-west-1.compute.internal"
  ]
}
JS

Retrieve cluster status

Retrieve cluster nodes status

GET /api/status

JSON Format

NameTypeDescription
consoleStringThe URL address of the Developer Console
restartingBooleantrue if the cluster is restarting
primaryBooleantrue if the current node is a primary master node
_nodes.nodeStringIP address of the node
_nodes.pingIntegerTime took to send a PING command to this node, in ms
_nodes.attachedBooleanIf the node is attached in the cluster. If not, you should run an INIT command
_nodes.errorStringIf an error occurs during a PING, the message is given in this field
_nodes.masterIntegerThe master number of this node. The lowest number gives you the current master node, otherwise secondaries master. If the value is -1, the node is a slave.

Example response

{
  "nodes": [
    {
      "node": "ip-172-31-12-124.eu-west-1.compute.internal",
      "ping": 1,
      "attached": true,
      "error": "",
      "master": 0
    },
    {
      "node": "ip-172-31-7-12.eu-west-1.compute.internal",
      "ping": 14,
      "attached": true,
      "error": "",
      "master": 1
    },
    {
      "node": "ip-172-31-6-126.eu-west-1.compute.internal",
      "ping": 13,
      "attached": true,
      "error": "",
      "master": -1
    }
  ],
  "console": "https://mycluster.indexima.io:8080",
  "restarting": false,
  "primary": true
}
JS