This Node Monitor is a comprehensive tool designed for Lilypad network participants. It performs several key functions:
- Monitors the online status of your Lilypad node
- Checks for recent Proof of Work (PoW) signals
- Maintains a WebSocket connection to an Arbitrum node via Infura for real-time updates
- Sends alerts via Telegram if any issues are detected
- Checks node online status through Lilypad's API
- Monitors for recent PoW signals to ensure node activity
- Maintains a persistent WebSocket connection to Arbitrum for real-time block updates
- Sends alerts via Telegram for various issues:
- Node going offline
- Lack of recent PoW signals
- Loss of WebSocket connection
- Automatically attempts to restart services if problems are detected
- Configurable check intervals and alert thresholds
- Ubuntu 20.04 or later
- Node.js and npm
wscat
(WebSocket client)- Curl
- jq (for JSON processing)
- A Telegram Bot Token and Chat ID
- An Infura Project ID with access to Arbitrum
- A Lilypad node set up and running
-
Clone this repository:
git clone https://github.com/your-repo/lilypad-node-monitor.git cd lilypad-node-monitor
-
Install the required dependencies:
sudo apt-get update sudo apt-get install -y nodejs npm curl jq sudo npm install -g wscat
-
Set up your environment variables. Create a
.env
file in the project directory:NODE_WALLET_ID=your_lilypad_node_wallet_id TELEGRAM_BOT_TOKEN=your_telegram_bot_token TELEGRAM_CHAT_ID=your_telegram_chat_id INFURA_PROJECT_ID=your_infura_project_id ONLINE_STATUS_URL=https://api-testnet.lilypad.tech/metrics-dashboard/nodes POW_SIGNAL_URL=https://api-sepolia.arbiscan.io/api
-
Edit the
node_monitor.sh
andwebsocket_monitor.sh
scripts to ensure all paths and configurations are correct. -
Make the scripts executable:
chmod +x node_monitor.sh websocket_monitor.sh
-
Set up the systemd services for both monitors. Create two service files:
sudo nano /etc/systemd/system/node-monitor.service sudo nano /etc/systemd/system/websocket-monitor.service
Add the appropriate content to each, similar to:
[Unit] Description=Lilypad Node Monitor Service After=network.target [Service] Type=simple ExecStart=/bin/bash /path/to/your/node_monitor.sh Restart=always User=root Group=root Environment=PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin WorkingDirectory=/path/to/your/script/directory [Install] WantedBy=multi-user.target
-
Reload systemd, enable and start the services:
sudo systemctl daemon-reload sudo systemctl enable node-monitor.service websocket-monitor.service sudo systemctl start node-monitor.service websocket-monitor.service
Both monitor services will run automatically. You can check their status with:
sudo systemctl status node-monitor.service
sudo systemctl status websocket-monitor.service
View the logs:
sudo journalctl -u node-monitor.service -f
sudo journalctl -u websocket-monitor.service -f
You can adjust various parameters in both node_monitor.sh
and websocket_monitor.sh
scripts:
- Check intervals
- Alert thresholds
- Cooldown periods for restarts
Refer to the comments in each script for details on what each parameter does.
- If services fail to start, check the logs for error messages.
- Ensure all environment variables in the
.env
file are correctly set. - Verify your Infura Project ID has access to Arbitrum and WebSocket connections are enabled.
- Test Telegram notifications manually to ensure the bot token and chat ID are correct.
- Check that your Lilypad node is properly set up and the wallet ID is correct.
Contributions to improve the Node Monitor are welcome. Please feel free to submit pull requests or open issues for bugs and feature requests.
This node monitor is an essential tool for Lilypad network participants. It helps ensure your node remains active and responsive, contributing effectively to the network. By monitoring multiple aspects of node operation, including online status, PoW signals, and real-time blockchain updates, it provides comprehensive oversight of your Lilypad node's health and performance.
For more information about Lilypad and how to set up a node, please refer to the official Lilypad documentation.