Skip to content

wuehler/prysm-block-monitor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

Prysm Validator Block Proposal Monitor

A Python script that monitors Prysm validator logs for upcoming block proposals and sends Pushover notifications.

Overview

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.

Requirements

  • Python 3.x
  • requests library (pip install requests)
  • Pushover account (for notifications)

Installation

  1. Clone this repository:

    cd ~
    git clone https://github.com/wuehler/prysm-block-monitor.git
    cd prysm-block-monitor
  2. Install dependencies:

    pip install requests --user
  3. Create your config file by copying the example:

    cp file_monitor_config.example.json file_monitor_config.json
  4. Edit file_monitor_config.json with 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
    }

Usage

Test log file access

python3 file_block_monitor.py --test

Test Pushover notifications

python3 file_block_monitor.py --test-pushover

Run in foreground

python3 file_block_monitor.py

Run as background service (recommended)

nohup python3 file_block_monitor.py >> file_block_monitor.log 2>&1 &

Check if running

ps aux | grep file_block_monitor

View logs

tail -f file_block_monitor.log

Stop the monitor

pkill -f file_block_monitor.py

Configuration Options

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

Pushover Priority Levels

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)

Running as a Service

Option 1: nohup (simple)

cd ~/prysm-block-monitor
nohup python3 file_block_monitor.py >> file_block_monitor.log 2>&1 &

Option 2: systemd (Linux, survives reboots)

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.target

Then enable and start:

sudo systemctl enable block-monitor
sudo systemctl start block-monitor

How It Works

  1. The script monitors your Prysm validator log file for lines containing Schedule for epoch with proposerCount=
  2. When a proposal is detected, it calculates the time until the proposal epoch
  3. If the proposal is within the alert threshold, it sends a Pushover notification
  4. The script tracks alerted proposals to avoid duplicate notifications

Troubleshooting

Script not detecting proposals:

  • Run python3 file_block_monitor.py --test to 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-pushover to 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

License

MIT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages