Health API
This API can be used for measuring 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

1
/ext/health
Copied!

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

1
health.health() -> {
2
checks: []{
3
checkName: {
4
message: JSON,
5
error: JSON,
6
timestamp: string,
7
duration: int,
8
contiguousFailures: int,
9
timeOfFirstFailure: int
10
}
11
},
12
healthy: bool
13
}
Copied!
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

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

Example Response

In this example response, the C-Chain’s health check is failing.
1
{
2
"jsonrpc": "2.0",
3
"result": {
4
"checks": {
5
"C": {
6
"message": null,
7
"error": {
8
"message": "example error message"
9
},
10
"timestamp": "2020-10-14T14:04:20.57759662Z",
11
"duration": 465253,
12
"contiguousFailures": 50,
13
"timeOfFirstFailure": "2020-10-14T13:16:10.576435413Z"
14
},
15
"P": {
16
"message": {
17
"percentConnected": 0.9967694992864075
18
},
19
"timestamp": "2020-10-14T14:04:08.668743851Z",
20
"duration": 433363830,
21
"contiguousFailures": 0,
22
"timeOfFirstFailure": null
23
},
24
"X": {
25
"timestamp": "2020-10-14T14:04:20.3962705Z",
26
"duration": 1853,
27
"contiguousFailures": 0,
28
"timeOfFirstFailure": null
29
},
30
"chains.default.bootstrapped": {
31
"timestamp": "2020-10-14T14:04:04.238623814Z",
32
"duration": 8075,
33
"contiguousFailures": 0,
34
"timeOfFirstFailure": null
35
},
36
"network.validators.heartbeat": {
37
"message": {
38
"heartbeat": 1602684245
39
},
40
"timestamp": "2020-10-14T14:04:05.610007874Z",
41
"duration": 6124,
42
"contiguousFailures": 0,
43
"timeOfFirstFailure": null
44
}
45
},
46
"healthy": false
47
},
48
"id": 1
49
}
Copied!
Last modified 19d ago