⚠️Blast API (blastapi.io) ends Oct 31. Migrate to Dwellir and skip Alchemy's expensive compute units.
Switch Today →
Skip to main content

system_health

Description#

Retrieves the health status of a Polkadot node, including peer count, synchronization status, and overall node health. This method is essential for monitoring node performance and network connectivity.

Parameters#

This method does not require any parameters.

Returns#

FieldTypeDescription
peersnumberNumber of connected peers
isSyncingbooleanWhether the node is currently syncing with the network
shouldHavePeersbooleanWhether the node should have peers (false for dev nodes)

Request Example#

{
"jsonrpc": "2.0",
"method": "system_health",
"params": [],
"id": 1
}

Response Example#

{
"jsonrpc": "2.0",
"result": {
"peers": 25,
"isSyncing": false,
"shouldHavePeers": true
},
"id": 1
}

Code Examples#

curl https://api-asset-hub-polkadot.n.dwellir.com/YOUR_API_KEY \
-X POST \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "system_health",
"params": [],
"id": 1
}'

Health Status Interpretation#

Peer Count#

PeersStatusDescription
0CriticalNo network connectivity
1-2WarningLow connectivity, may have issues
3-10GoodAcceptable connectivity
10+ExcellentWell connected to network

Sync Status#

isSyncingMeaning
trueNode is downloading and processing historical blocks
falseNode is synchronized with the network

Should Have Peers#

shouldHavePeersMeaning
trueNormal network node, should connect to peers
falseDevelopment/isolated node, peer connection optional

Use Cases#

  1. Monitoring Dashboards: Display node health metrics
  2. Alerting Systems: Trigger alerts on connectivity issues
  3. Load Balancers: Route traffic based on node health
  4. Deployment Validation: Verify node setup and connectivity
  5. Troubleshooting: Diagnose synchronization problems

Monitoring Best Practices#

Health Check Implementation#

class HealthChecker {
constructor(endpoint, apiKey) {
this.endpoint = endpoint;
this.apiKey = apiKey;
this.healthHistory = [];
}

async check() {
try {
const health = await this.getHealth();

this.healthHistory.push({
timestamp: Date.now(),
...health
});

// Keep last 100 checks
if (this.healthHistory.length > 100) {
this.healthHistory.shift();
}

return this.analyzeHealth(health);
} catch (error) {
return {
status: 'error',
message: error.message
};
}
}

analyzeHealth(health) {
const issues = [];

if (health.peers === 0 && health.shouldHavePeers) {
issues.push('No peer connections');
}

if (health.peers < 3 && health.shouldHavePeers) {
issues.push('Low peer count');
}

if (health.isSyncing) {
issues.push('Node syncing');
}

return {
status: issues.length === 0 ? 'healthy' : 'degraded',
issues,
metrics: health
};
}

getAveragePeers() {
if (this.healthHistory.length === 0) return 0;

const sum = this.healthHistory.reduce(
(acc, h) => acc + h.peers, 0
);

return sum / this.healthHistory.length;
}
}

Notes#

  • Health checks should be performed regularly but not excessively
  • Peer count can fluctuate normally - look for trends
  • Syncing status is normal for new nodes or after downtime
  • Consider multiple health checks before triggering alerts
  • Different node types (validator, full, light) have different health characteristics