Metrics-tee is a simple node.js http service that accepts http requests and forwards them to multiple other endpoints. It was built to send Solana node metrics to multiple influxdb instances.
Make sure you have installed the following prerequisites on your machine:
- node.js and npm
sudo apt install -y nodejs npm- pm2 process manager for Node.js apps (optional)
npm install pm2 -ggit clone https://github.com/coverlet/metrics-tee.git
cd metrics-tee
npm iRename config.sample.json to config.json and add all the endpoints that you want the metrics to be forwarded to:
{
"port": 3311,
"endpoints": [
"https://metrics.solana.com:8086/write?db=netdb&u=user&p=pass&precision=ms",
"http://yourinfluxdcinstance.com:8096/write?db=db&u=user&p=pass&precision=ms",
...
]
}
Point solana metrics config env variable to the metrics-tee instance:
Environment="SOLANA_METRICS_CONFIG=host=http://127.0.0.1:3311,db=a,u=a,p=a"Note that db=a,u=a,p=a are not used (you already configured the influxdb config for each endpoint in config.js), but if they are not present the node will not export the metrics.
Build and start the app with pm2:
npm run pm2Make sure the process starts on system reboot:
pm2 startup
pm2 saveAlternatively, you can use systemd service manager to handle app execution. In your .service file, use this for ExecStart:
ExecStart=/usr/bin/node /path/to/metrics-tee/build/index.js