Health API

Get health data for your Sensu instance

The /health API endpoint provides HTTP GET access to health data for your Sensu instance.

Example

The following example demonstrates a request to the /health API endpoint, resulting in a JSON map that contains Sensu health data.

curl -X GET \
http://127.0.0.1:8080/health

HTTP/1.1 200 OK
{
  "Alarms": null,
  "ClusterHealth": [
    {
      "MemberID": 2882886652148554927,
      "MemberIDHex": "8923110df66458af",
      "Name": "default",
      "Err": "",
      "Healthy": true
    }
  ],
  "Header": {
    "cluster_id": 4255616344056076734,
    "member_id": 2882886652148554927,
    "raft_term": 26
  },
  "PostgresHealth": [
    {
      "Name": "my-postgres",
      "Active": false,
      "Healthy": false
    }
  ]
}

NOTE: If your Sensu instance is not configured to use a PostgreSQL datastore, the health payload will not include PostgresHealth.

API Specification

/health (GET)
description Returns health information about the Sensu instance.
example url http://hostname:8080/health
query parameters timeout: Defines the timeout when querying etcd. Default is 3.
response type Map
response codes
  • Success: 200 (OK)
  • Error: 400 (Bad Request)

NOTE: The HTTP response codes for the health endpoint indicate whether your request reached Sensu rather than the health of your Sensu instance. To determine the health of your Sensu instance, you must process the JSON response body for your request. The health specification describes each attribute in the response body.

output
{
  "Alarms": null,
  "ClusterHealth": [
    {
      "MemberID": 2882886652148554927,
      "MemberIDHex": "8923110df66458af",
      "Name": "default",
      "Err": "",
      "Healthy": true
    }
  ],
  "Header": {
    "cluster_id": 4255616344056076734,
    "member_id": 2882886652148554927,
    "raft_term": 26
  },
  "PostgresHealth": [
    {
      "Name": "my-postgres",
      "Active": false,
      "Healthy": false
    }
  ]
}

Get health data for your agent transport

The /health API endpoint provides HTTP GET access to health data for your Sensu agent transport via the backend WebSocket. Sensu backend /health API information is duplicated by this agent transport API endpoint as an affordance to satisfy the load balancing and security requirements of some deployments.

Example

The following example demonstrates a request to the backend WebSocket /health API endpoint using the default WebSocket port 8081, resulting in a JSON map that contains Sensu agent transport status.

curl -X GET \
http://127.0.0.1:8081/health

HTTP/1.1 200 OK
{
  "Alarms": null,
  "ClusterHealth": [
    {
      "MemberID": 2882886652148554927,
      "MemberIDHex": "8923110df66458af",
      "Name": "default",
      "Err": "",
      "Healthy": true
    }
  ],
  "Header": {
    "cluster_id": 4255616344056076734,
    "member_id": 2882886652148554927,
    "raft_term": 26
  },
  "PostgresHealth": [
    {
      "Name": "my-postgres",
      "Active": false,
      "Healthy": false
    }
  ]
}

NOTE: If your Sensu instance is not configured to use a PostgreSQL datastore, the health payload will not include PostgresHealth.

API Specification

/health (GET)
description Returns health information about the Sensu agent transport.
example url http://hostname:8081/health
query parameters timeout: Defines the timeout when querying etcd. Default is 3.
response type Map
response codes
  • Success: 200 (OK)
  • Error: 400 (Bad Request)

NOTE: The HTTP response codes for the health endpoint indicate whether your request reached Sensu rather than the health of your Sensu instance. To determine the health of your Sensu instance, you must process the JSON response body for your request. The health specification describes each attribute in the response body.

output
{
  "Alarms": null,
  "ClusterHealth": [
    {
      "MemberID": 2882886652148554927,
      "MemberIDHex": "8923110df66458af",
      "Name": "default",
      "Err": "",
      "Healthy": true
    }
  ],
  "Header": {
    "cluster_id": 4255616344056076734,
    "member_id": 2882886652148554927,
    "raft_term": 26
  },
  "PostgresHealth": [
    {
      "Name": "my-postgres",
      "Active": false,
      "Healthy": false
    }
  ]
}