system_health
Description#
Returns the current health status of an Astar node, including peer connectivity and synchronization state. Useful for infrastructure monitoring and alerting.
Parameters#
This method does not require any parameters.
Returns#
| Field | Type | Description |
|---|---|---|
peers | number | Connected peer count |
isSyncing | boolean | Indicates whether the node is catching up |
shouldHavePeers | boolean | False only for isolated development nodes |
Request Example#
{
"jsonrpc": "2.0",
"method": "system_health",
"params": [],
"id": 1
}
Response Example#
{
"jsonrpc": "2.0",
"result": {
"peers": 37,
"isSyncing": false,
"shouldHavePeers": true
},
"id": 1
}
Code Examples#
- cURL
- Python
- JavaScript
curl https://api-astar.n.dwellir.com/YOUR_API_KEY \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "system_health",
"params": [],
"id": 1
}'
import requests
import json
payload = {
"jsonrpc": "2.0",
"method": "system_health",
"params": [],
"id": 1
}
resp = requests.post(
"https://api-astar.n.dwellir.com/YOUR_API_KEY",
headers={"Content-Type": "application/json"},
data=json.dumps(payload),
timeout=10
)
health = resp.json()["result"]
print("Peers:", health["peers"], "Syncing:", health["isSyncing"])
async function checkNodeHealth() {
const response = await fetch('https://api-astar.n.dwellir.com/YOUR_API_KEY', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
jsonrpc: '2.0',
method: 'system_health',
params: [],
id: 1
})
});
const { result } = await response.json();
return {
peers: result.peers,
status: result.isSyncing ? 'syncing' : 'ready'
};
}