A Python script that monitors Prysm validator logs for upcoming block proposals and sends Pushover notifications.
This script directly monitors your Prysm validator log file (rather than using Docker APIs) and alerts you when your validator is scheduled to propose a block. This gives you advance warning to avoid maintenance during critical proposal windows.
- Python 3.x
requestslibrary (pip install requests)- Pushover account (for notifications)
-
Clone this repository:
cd ~ git clone https://github.com/wuehler/prysm-block-monitor.git cd prysm-block-monitor
-
Install dependencies:
pip install requests --user
-
Create your config file by copying the example:
cp file_monitor_config.example.json file_monitor_config.json
-
Edit
file_monitor_config.jsonwith your settings:{ "log_file_path": "/path/to/your/prysm-validator-logs/validator.log", "pushover": { "enabled": true, "app_token": "YOUR_PUSHOVER_APP_TOKEN", "user_key": "YOUR_PUSHOVER_USER_KEY", "priority": 0 }, "alert_hours_ahead": 2, "check_interval": 30 }
python3 file_block_monitor.py --testpython3 file_block_monitor.py --test-pushoverpython3 file_block_monitor.pynohup python3 file_block_monitor.py >> file_block_monitor.log 2>&1 &ps aux | grep file_block_monitortail -f file_block_monitor.logpkill -f file_block_monitor.py| Option | Description | Default |
|---|---|---|
log_file_path |
Path to your Prysm validator log file | Required |
pushover.enabled |
Enable/disable Pushover notifications | false |
pushover.app_token |
Your Pushover application token | Required if enabled |
pushover.user_key |
Your Pushover user key | Required if enabled |
pushover.priority |
Pushover notification priority level | 0 |
alert_hours_ahead |
Hours before proposal to start alerting | 2 |
check_interval |
Seconds between log file checks | 30 |
Set pushover.priority in your config to one of these values:
-2= No notification (silent)-1= Quiet (no sound/vibration)0= Normal (default)1= High priority (bypasses quiet hours)2= Emergency (requires acknowledgment)
cd ~/prysm-block-monitor
nohup python3 file_block_monitor.py >> file_block_monitor.log 2>&1 &Create /etc/systemd/system/block-monitor.service:
[Unit]
Description=Prysm Block Proposal Monitor
After=network.target
[Service]
Type=simple
User=YOUR_USER
WorkingDirectory=/home/YOUR_USER/prysm-block-monitor
ExecStart=/usr/bin/python3 file_block_monitor.py
Restart=on-failure
RestartSec=30
[Install]
WantedBy=multi-user.targetThen enable and start:
sudo systemctl enable block-monitor
sudo systemctl start block-monitor- The script monitors your Prysm validator log file for lines containing
Schedule for epochwithproposerCount= - When a proposal is detected, it calculates the time until the proposal epoch
- If the proposal is within the alert threshold, it sends a Pushover notification
- The script tracks alerted proposals to avoid duplicate notifications
Script not detecting proposals:
- Run
python3 file_block_monitor.py --testto verify log file access - Check that the log file path in config matches your actual log location
Pushover not working:
- Run
python3 file_block_monitor.py --test-pushoverto test notifications - Verify your app_token and user_key are correct
Script stopped running:
- Check if process is still running:
ps aux | grep file_block_monitor - Check logs for errors:
tail -100 file_block_monitor.log - Consider setting up as a systemd service for auto-restart on reboot
MIT