0G Storage Node Monitoring Script
Follow these steps to set up the monitoring script for your 0G Storage node.
Step 1: Download the Monitoring Script
Navigate to your home directory and download the monitoring script:
Download monitoring-og.sh file:
cd $HOME
wget -O monitoring-og.sh https://raw.githubusercontent.com/itrocket-team/testnet_guides/main/0g/monitoring-og.sh
chmod +x monitoring-og.sh
Step 2: Configure Telegram Alerts
Open Telegram and find @BotFather. Refer to these resources for configuration:
- Instructions for Telegram Alerts
- How to get chat id
Step 3: Edit Script
Edit the script to configure your Telegram credentials and node settings:
nano monitoring-og.sh
Inside the file, configure the following variables:
TELEGRAM_BOT_TOKEN=""
TELEGRAM_CHAT_ID=""
STORAGE_RPC_PORT="" # If you don't want to monitor storage node, leave the field empty. Default port 5678.
VALIDATOR_RPC_PORT="" # If you don't want to monitor validator node, leave the field empty. Default port 26657.
Step 4: Set Up the Systemd Service
Create and edit the service file:
sudo tee /etc/systemd/system/monitoring-og.service > /dev/null <<EOF
[Unit]
Description=OG Storage Node Monitoring
After=network.target
[Service]
User=$USER
ExecStart="$HOME/monitoring-og.sh"
WorkingDirectory=$HOME
StandardOutput=inherit
StandardError=inherit
Restart=always
[Install]
WantedBy=multi-user.target
EOF
Step 5: Start the Service
Reload the systemd daemon and enable the service to start on boot:
sudo systemctl daemon-reload
sudo systemctl enable monitoring-og
sudo systemctl restart monitoring-og && sudo journalctl -u monitoring-og -fo cat
Removing the Service and Script (if needed)
If you need to remove the service and script, execute the following commands:
sudo systemctl stop monitoring-og
sudo systemctl disable monitoring-og
sudo rm -rf /etc/systemd/system/monitoring-og.service
rm ~/monitoring-og.sh
sudo systemctl daemon-reload