Node Health Checker
The Aptos Node Health Checker (NHC) service can be used to check the health of any Aptos fullnodes (VFNs or PFNs). If you are a node operator, use the NHC service to check if your node is running correctly. The NHC service evaluates your node's health by comparing against a baseline node configuration, and outputs the evaluation results.
This document describes how to run NHC locally when you are operating a node.
If you don't want to run the NHC service yourself, you can use the publicly available NHC service run by the Aptos Foundation.
Quickstart
Before you get into the details of how NHC works, you can run the below steps to start the NHC service and send it a request. This tutorial uses a baseline configuration for a devnet fullnode, i.e., it will evaluate your node against a devnet fullnode that is configured with the baseline configuration YAML.
Important: If your local node is not a devnet fullnode, you must use a different baseline config. See the configuration examples in aptos-core for other such example configs.
Step 1: Download the baseline configuration YAML
Download a baseline configuration YAML file for a devnet fullnode. The below command will download the devnet_fullnode.yaml
configuration file:
mkdir /tmp/nhc
cd /tmp/nhc
wget https://raw.githubusercontent.com/aptos-labs/aptos-core/main/ecosystem/node-checker/configuration_examples/devnet_fullnode.yaml
Step 2: Start the NHC service
Start the NHC service by providing the above-downloaded devnet_fullnode.yaml
baseline configuration YAML file:
docker run -v /tmp/nhc:/nhc -p 20121:20121 -t aptoslabs/node-checker:nightly /usr/local/bin/aptos-node-checker server run --baseline-config-paths /nhc/devnet_fullnode.yaml
Step 3: Send a request to NHC service
Finally, send a request to the NHC service you started above. The following command runs health checks of your node that is at node_url=http://mynode.mysite.com
and compares these results with the node configured in the baseline configuration devnet_fullnode
:
curl 'http://localhost:20121/check?node_url=http://mynode.mysite.com&api_port=80&baseline_configuration_id=devnet_fullnode'
You will see output similar to this:
{
"check_results": [
{
"headline": "Chain ID reported by baseline and target match",
"score": 100,
"explanation": "The node under investigation reported the same Chain ID 18 as is reported by the baseline node",
"checker_name": "node_identity",
"links": []
},
{
"headline": "Role Type reported by baseline and target match",
"score": 100,
"explanation": "The node under investigation reported the same Role Type full_node as is reported by the baseline node",
"checker_name": "node_identity",
"links": []
},
{
"headline": "Target node produced valid recent transaction",
"score": 100,
"explanation": "We were able to pull the same transaction (version: 3238616) from both your node and the baseline node. Great! This implies that your node is keeping up with other nodes in the network.",
"checker_name": "transaction_availability",
"links": []
}
],
"summary_score": 100,
"summary_explanation": "100: Awesome!"
}
How NHC works
The NHC runs as a service. When you want to run a health check of your node, you send the HTTP requests to this service.
A single NHC instance can be configured to check the health of multiple node configurations, each of different type, for example:
- A public fullnode connected to the Aptos mainnet.
- A validator node connected to the Aptos testnet.
- A node running in a single node testnet.
Baseline configuration
In all the above cases, a baseline node is used to compare your node's health. For example, for a public fullnode connected to the Aptos devnet, the baseline node might be a node run by the Aptos team and this node demonstrates optimal performance and participation characteristics.
You will download the baseline configuration YAML before running the NHC service for your node. The baseline node's configuration YAML describes where to find this baseline node (URL + port), what evaluators (e.g. metrics checks, TPS tests, API validations, etc.) the NHC service should run, what parameters the NHC should use for those evaluators, what name the configuration has, and so on. See these example baseline configuration YAML files.
When you send requests to the NHC service, you must include a baseline configuration. For example, a request to NHC to use devnet_fullnode
as the baseline configuration will look like this:
curl 'http://nhc.aptoslabs.com/check?node_url=http://myfullnode.mysite.com&baseline_configuration_id=devnet_fullnode'