Cluster API

The /cluster/members API endpoint

/cluster/members (GET)

The /cluster/members API endpoint provides HTTP GET access to Sensu cluster data.

EXAMPLE

The following example demonstrates a request to the /cluster/members API, resulting in a JSON Map containing a Sensu cluster definition.

curl -H "Authorization: Bearer TOKEN" \
http://127.0.0.1:8080/api/core/v2/cluster/members

HTTP/1.1 200 OK
{
  "header": {
    "cluster_id": 4255616304056076734,
    "member_id": 9882886658148554927,
    "raft_term": 2
  },
  "members": [
    {
      "ID": 9882886658148554927,
      "name": "default",
      "peerURLs": [
        "http://127.0.0.1:2380"
      ],
      "clientURLs": [
        "http://127.0.0.1:2379"
      ]
    }
  ]
}

API Specification

/cluster/members (GET)
description Returns the cluster definition.
example url http://hostname:8080/api/core/v2/cluster/members
response type Map
response codes
  • Success: 200 (OK)
  • Error: 500 (Internal Server Error)
example output
{
  "header": {
    "cluster_id": 4255616304056076734,
    "member_id": 9882886658148554927,
    "raft_term": 2
  },
  "members": [
    {
      "ID": 9882886658148554927,
      "name": "default",
      "peerURLs": [
        "http://127.0.0.1:2380"
      ],
      "clientURLs": [
        "http://127.0.0.1:2379"
      ]
    }
  ]
}

/cluster/members (POST)

The /cluster/members API endpoint provides HTTP POST access to create a Sensu cluster member.

EXAMPLE

curl -X POST \
-H "Authorization: Bearer TOKEN" \
http://127.0.0.1:8080/api/core/v2/cluster/members?peer-addrs=http://127.0.0.1:2380

HTTP/1.1 200 OK
{
  "header": {
    "cluster_id": 4255616304056077000,
    "member_id": 9882886658148555000,
    "raft_term": 2
  },
  "members": [
    {
      "ID": 9882886658148555000,
      "name": "default",
      "peerURLs": [
        "http://127.0.0.1:2380"
      ],
      "clientURLs": [
        "http://localhost:2379"
      ]
    }
  ]
}

API Specification

/cluster/members/:member (POST)
description Creates a cluster member.
example url http://hostname:8080/api/core/v2/cluster/members?peer-addrs=http://127.0.0.1:2380
query parameters
  • peer-addrs (required): A comma-delimited list of peer addresses
response codes
  • Success: 200 (OK)
  • Missing: 404 (Not Found)
  • Error: 500 (Internal Server Error)

The /cluster/members/:member API endpoint

/cluster/members/:member (PUT)

EXAMPLE

curl -X PUT \
-H "Authorization: Bearer TOKEN" \
http://127.0.0.1:8080/api/core/v2/cluster/members/8927110dc66458af?peer-addrs=http://127.0.0.1:2380

HTTP/1.1 200 OK
{
  "header": {
    "cluster_id": 4255616304056077000,
    "member_id": 9882886658148555000,
    "raft_term": 2
  },
  "members": [
    {
      "ID": 9882886658148555000,
      "name": "default",
      "peerURLs": [
        "http://127.0.0.1:2380"
      ],
      "clientURLs": [
        "http://localhost:2379"
      ]
    }
  ]
}

API Specification

/cluster/members/:member (PUT)
description Creates a cluster member.
example url http://hostname:8080/api/core/v2/cluster/members/8927110dc66458af?peer-addrs=http://127.0.0.1:2380
url parameters
  • 8927110dc66458af (required): Required hex-encoded uint64 cluster member ID generated using sensuctl cluster member-list
query parameters
  • peer-addrs (required): A comma-delimited list of peer addresses
response codes
  • Success: 200 (OK)
  • Missing: 404 (Not Found)
  • Error: 500 (Internal Server Error)

/cluster/members/:member (DELETE)

The /cluster/members/:member API endpoint provides HTTP DELETE access to remove a Sensu cluster member.

API Specification

/cluster/ members/:member (DELETE)
description Removes a member from a Sensu cluster given the member ID.
example url http://hostname:8080/api/core/v2/cluster/members/8927110dc66458af
url parameters
  • 8927110dc66458af (required): Required hex-encoded uint64 cluster member ID generated using sensuctl cluster member-list
response codes
  • Success: 202 (Accepted)
  • Missing: 404 (Not Found)
  • Error: 500 (Internal Server Error)