Home

Health check API

This API can be used for measuring a node health.

To get an HTTP status code response that indicates the node’s health, make a GET request to /ext/health. If the node is healthy, it will return a 200 status code. If you want more in-depth information about a node’s health, use the methods below.

Format#

This API uses the json 2.0 RPC format. For more information on making JSON RPC calls, see here.

Endpoint#


_10
/ext/health

Methods#

health.health#

The node runs a set of health checks every 30 seconds, including a health check for each chain. This method returns the last set of health check results.

Signature:


_13
health.health() -> {
_13
checks: []{
_13
checkName: {
_13
message: JSON,
_13
error: JSON,
_13
timestamp: string,
_13
duration: int,
_13
contiguousFailures: int,
_13
timeOfFirstFailure: int
_13
}
_13
},
_13
healthy: bool
_13
}

healthy is true if the node if all health checks are passing.

checks is a list of health check responses.

  • A check response may include a message with additional context.
  • A check response may include an error describing why the check failed.
  • timestamp is the timestamp of the last health check.
  • duration is the execution duration of the last health check, in nanoseconds.
  • contiguousFailures is the number of times in a row this check failed.
  • timeOfFirstFailure is the time this check first failed.

More information on these measurements can be found in the documentation for the go-sundheit library.

Example Call:


_10
curl -X POST --data '{
_10
"jsonrpc":"2.0",
_10
"id" :1,
_10
"method" :"health.health"
_10
}' -H 'content-type:application/json;' 127.0.0.1:9650/ext/health

Example Response:

In this example response, the Utility Chain’s health check is failing.


_49
{
_49
"jsonrpc": "2.0",
_49
"result": {
_49
"checks": {
_49
"C": {
_49
"message": null,
_49
"error": {
_49
"message": "example error message"
_49
},
_49
"timestamp": "2020-10-14T14:04:20.57759662Z",
_49
"duration": 465253,
_49
"contiguousFailures": 50,
_49
"timeOfFirstFailure": "2020-10-14T13:16:10.576435413Z"
_49
},
_49
"P": {
_49
"message": {
_49
"percentConnected": 0.9967694992864075
_49
},
_49
"timestamp": "2020-10-14T14:04:08.668743851Z",
_49
"duration": 433363830,
_49
"contiguousFailures": 0,
_49
"timeOfFirstFailure": null
_49
},
_49
"X": {
_49
"timestamp": "2020-10-14T14:04:20.3962705Z",
_49
"duration": 1853,
_49
"contiguousFailures": 0,
_49
"timeOfFirstFailure": null
_49
},
_49
"chains.default.bootstrapped": {
_49
"timestamp": "2020-10-14T14:04:04.238623814Z",
_49
"duration": 8075,
_49
"contiguousFailures": 0,
_49
"timeOfFirstFailure": null
_49
},
_49
"network.validators.heartbeat": {
_49
"message": {
_49
"heartbeat": 1602684245
_49
},
_49
"timestamp": "2020-10-14T14:04:05.610007874Z",
_49
"duration": 6124,
_49
"contiguousFailures": 0,
_49
"timeOfFirstFailure": null
_49
}
_49
},
_49
"healthy": false
_49
},
_49
"id": 1
_49
}