Health

Use Sensu’s health API to make sure your backend is up and running and check the health of your etcd cluster members and PostgreSQL datastore resources.

Health payload example

A request to the health endpoint retrieves a JSON map with health data for your Sensu instance.

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-first-postgres",
      "Active": true,
      "Healthy": true
    },
    {
      "Name": "my-other-postgres",
      "Active": false,
      "Healthy": false
    }
  ]
}

Health specification

Top-level attributes

Alarms
description Top-level attribute that lists all active etcd alarms.
required true
type String
example
"Alarms": null
ClusterHealth
description Top-level attribute that includes health status information for every etcd cluster member.
required true
type Map of key-value pairs
example
"ClusterHealth": [
    {
      "MemberID": 2882886652148554927,
      "MemberIDHex": "8923110df66458af",
      "Name": "default",
      "Err": "",
      "Healthy": true
    }
  ]
Header
description Top-level map that includes the response header for the entire cluster response.
required true
type Map of key-value pairs
example
"Header": {
    "cluster_id": 4255616344056076734,
    "member_id": 2882886652148554927,
    "raft_term": 26
  }
PostgresHealth
description Top-level map that includes health information for PostgreSQL resources. If your Sensu instance is not configured to use a PostgreSQL datastore, the health payload will not include PostgresHealth.
type Map of key-value pairs
example
"PostgresHealth": [
    {
      "Name": "postgres-test",
      "Active": false,
      "Healthy": false
    },
    {
      "Name": "postgres",
      "Active": true,
      "Healthy": true
    }
  ]

ClusterHealth attributes

Member ID
description The etcd cluster member’s ID.
required true
type Integer
example
"MemberID": 2882886652148554927
MemberIDHex
description The hexadecimal representation of the etcd cluster member’s ID.
required true
type String
example
"MemberIDHex": "8923110df66458af"
Name
description The etcd cluster member’s name.
required true
type String
example
Name": "default"
Err
description Any errors Sensu encountered while checking the etcd cluster member’s health.
required true
type String
example
"Err": ""
Healthy
description true if the etcd cluster member is connected. Otherwise, false.
required true
type Boolean
default false
example
"Healthy": true

Header attributes

cluster_id
description The etcd cluster ID.
required true
type Integer
example
"cluster_id": 4255616344056076734
member_id
description The etcd cluster member’s ID.
required true
type Integer
example
"member_id": 2882886652148554927
raft_term
description The etcd cluster member’s raft term.
required true
type Integer
example
"raft_term": 26

PostgresHealth attributes

Name
description The PostgreSQL configuration resource. Sensu retrieves the Name from datastore metadata.
required true
type String
example
"Name": "postgres"
Active
description true if the datastore is configured to use the PostgreSQL configuration. Otherwise, false.
required true
type Boolean
default false
example
"Active": true
Healthy
description true if the PostgreSQL datastore is connected and can query the events table. Otherwise, false.
required true
type Boolean
default false
example
"Healthy": true