A monitoring solution for Redbelly Node health and performance, utilizing Node.js, Prometheus, and Grafana to provide real-time insights into node operations.
- Real-time health checks for Redbelly Node services.
- Monitoring critical metrics like latest block number, service status, and node logs.
- Interactive Grafana dashboards for clear visualization.
Ensure you have the following installed on your server:
- Node.js (v14+)
- Prometheus
- Grafana
- Systemd (for service management)
git clone https://github.com/adacapo21/redbelly-monitor.git
cd redbelly-monitor
npm install
bash
node src/health-check.js
sudo nano /etc/systemd/system/node-health.service
[Unit]
Description=Redbelly Node Health Check Service
After=network.target
[Service]
ExecStart=/usr/bin/node /path/to/redbelly-monitor/src/health-check.js
Restart=always
User=root
Environment=PATH=/usr/bin:/usr/local/bin
Environment=NODE_ENV=production
WorkingDirectory=/path/to/redbelly-monitor
[Install]
WantedBy=multi-user.target
sudo systemctl daemon-reload
sudo systemctl enable node-health.service
sudo systemctl start node-health.service
sudo systemctl status node-health.service
sudo systemctl status node-health.service
sudo apt-get install prometheus
sudo apt-get install grafana
sudo nano /etc/prometheus/prometheus.yml
scrape_configs:
- job_name: 'redbelly-health'
static_configs:
- targets: ['localhost:9092']
sudo systemctl restart prometheus
sudo systemctl status prometheus
- Open Grafana in your browser (http://:3000)
- Log in with the default credentials (admin/admin) - you will be prompt to change these credentials.
- Add Prometheus as a data source (http://:9090).
- Import the Grafana dashboard
- Go to Dashboard > Import
- Add panels
- Query:
redbelly_latest_block
- Query:
up{job="redbelly-health"}
- Query:
- Save the dashboard.
- Name:
Redbelly Node Health Monitoring
- Name:
- Prometheus UI:
http://<server-ip>:9090
- Grafana Dashboard:
http://<server-ip>:3000
sudo ufw allow 9090
sudo ufw allow 9092
sudo ufw allow 3000
sudo ufw reload
sudo journalctl -u node-health.service -f
sudo journalctl -u prometheus -f
sudo journalctl -u grafana-server -f
cat /path/to/redbelly-monitor/logs/health-check.log
cat /var/log/prometheus/prometheus.log
cat /var/log/grafana/grafana.log
sudo systemctl status node-health.service
- Prometheus: http://:9092/metrics
You can access these health endpoints locally on your server:
curl http://localhost:9092/health/service
Returns the status of the Redbelly Node service, including process ID and systemd status.
curl http://localhost:9092/health/block
Returns the latest block number synced by the Redbelly Node.
curl http://localhost:9092/health/logs
Returns the last 100 lines of the Redbelly Node logs.
Feel free to open an issue or submit a pull request to improve this project.
This project is licensed under the MIT License. See the LICENSE file for details.