Skip to content

A professional, lightweight monitoring solution for Cosmos Validators using pure Bash scripts for simplicity and minimal system overhead. Monitor missed blocks, RAM usage, disk space with Telegram notifications. No complex frameworks, no heavy dependencies - just efficient, reliable monitoring tools.

License

Notifications You must be signed in to change notification settings

Quasar-hub/quasar-server-sentinel

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

10 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ›ก๏ธ Cosmos Validator Monitoring Tools

Cosmos Validator Monitoring

Professional monitoring solution for Cosmos Validators

We deliberately chose to use a combination of Bash and Python for this monitoring solution. This hybrid approach ensures both simplicity and reliability, while providing robust endpoint failover capabilities. The system automatically switches to backup RPC endpoints when needed, ensuring continuous monitoring even when primary endpoints fail.

Cosmos Telegram Python Bash License

๐Ÿš€ Features โ€ข ๐Ÿ“‹ Requirements โ€ข ๐Ÿ› ๏ธ Installation โ€ข ๐Ÿค Contributing


๐ŸŽฏ Why Choose This Tool?

๐Ÿ” Real-time Monitoring

  • โšก Instant block validation checks
  • ๐Ÿ”„ Automatic RPC endpoint failover
  • ๐ŸŒ Multi-chain support
  • ๐Ÿค– Automated alert system
  • ๐Ÿ’ฝ Regular disk space monitoring
  • ๐ŸŽฎ Active RAM usage tracking
  • ๐Ÿค– Automated alert system

๐Ÿ›ก๏ธ Proactive Management

  • ๐Ÿ”„ Automatic server reboot on high RAM
  • ๐Ÿ” Smart endpoint selection
  • โš™๏ธ Customizable alert thresholds
  • ๐Ÿ“ฑ Telegram notifications
  • ๐Ÿ“Š Detailed logging system

๐Ÿ”„ How It Works

%%{init: { 'theme': 'base', 'themeVariables': { 'primaryColor': 'rgba(33, 38, 45, 0.8)', 'primaryTextColor': '#C9D1D9', 'primaryBorderColor': 'rgba(48, 54, 61, 0.8)', 'lineColor': '#2ebd11', 'secondaryColor': 'rgba(33, 38, 45, 0.8)', 'tertiaryColor': 'rgba(33, 38, 45, 0.8)', 'noteTextColor': '#C9D1D9', 'noteBkgColor': 'rgba(33, 38, 45, 0.8)', 'noteBorderColor': 'rgba(48, 54, 61, 0.8)', 'labelTextColor': '#C9D1D9', 'labelBoxBkgColor': 'rgba(33, 38, 45, 0.8)', 'labelBoxBorderColor': 'rgba(48, 54, 61, 0.8)', 'stateBkg': 'rgba(33, 38, 45, 0.8)', 'stateLabelColor': '#C9D1D9', 'compositeBackground': 'transparent', 'altBackground': 'rgba(33, 38, 45, 0.8)' } }}%% stateDiagram-v2 [*] --> CronScheduler: ๐Ÿš€ Start Monitoring state CronScheduler { state "๐Ÿ“Š check.sh" as BlocksMonitor state "๐ŸŽฎ ram_check.sh" as RAMMonitor state "๐Ÿ’พ disk_check.sh" as DiskMonitor note right of BlocksMonitor Every 5 minutes Checks last 10 blocks end note note right of RAMMonitor Every 5 minutes Threshold: 15GB end note note right of DiskMonitor Every 6 hours Threshold: <100GB free end note } state "System Checks" as Checks { state "๐Ÿ” Check Last 10 Blocks" as Blocks state "โšก Check RAM Usage" as RAM state "๐Ÿ“€ Check Free Space" as Disk } BlocksMonitor --> Blocks: Monitor RAMMonitor --> RAM: Track DiskMonitor --> Disk: Analyze state "Alert Process" as Alerts { state "๐Ÿ“ Prepare Message" as PrepareMsg state "๐Ÿ“ฑ Send Telegram" as SendTG state "๐Ÿ“‹ Write Logs" as Log } Blocks --> PrepareMsg: โŒ Missed in last 10 RAM --> PrepareMsg: โš ๏ธ Usage โ‰ฅ 15GB Disk --> PrepareMsg: ๐Ÿ’พ Free < 100GB PrepareMsg --> SendTG: ๐Ÿ“ค Notify SendTG --> Log: ๐Ÿ“ฅ Record state "๐Ÿ”„ System Reboot" as Reboot RAM --> Reboot: After alert sent note right of Alerts All alerts are sent to Telegram and logged in system logs end note 
Loading

โœจ Features

Feature Description Check Interval
๐Ÿ” Missed Blocks Detection Real-time validator performance tracking Every 5 minutes
๐ŸŽฎ RAM Management Proactive memory management Every 5 minutes
๐Ÿ’พ Disk Space Monitoring Regular storage monitoring Every 6 hours
๐Ÿ”” Telegram Alerts Instant notifications On events
๐Ÿ“Š Performance Logs Comprehensive system logs Continuous
โšก Auto-Recovery Smart reboot system On RAM alert

๐Ÿ“‹ Requirements

Requirement Minimum Recommended
๐Ÿง Linux Ubuntu 20.04 Ubuntu 22.04
๐Ÿ”„ curl 7.68.0 Latest
๐Ÿ”„ Python 3.8+ Latest
๐Ÿ”ง jq 1.6 Latest
๐Ÿ“ฑ Telegram Bot Any Latest
๐Ÿ’ป Bash 5.0 Latest

Required Python packages:

pip3 install requests

๐Ÿค– Telegram Bot Setup

  1. Create a new bot:

    • Message @BotFather on Telegram
    • Use /newbot command
    • Follow instructions to create bot
    • Copy the provided API token
  2. Get Chat ID:

    • Add bot to your group
    • Make bot admin
    • Send any message to group
    • Visit: https://api.telegram.org/bot<YourBOTToken>/getUpdates
    • Find "chat" -> "id" in the response
  3. Get Thread ID (if using topics):

    • Enable topics in group settings
    • Create new topic
    • Send message in topic
    • Find "message_thread_id" in the getUpdates response
  4. Update script variables:

# Edit check.sh BOT_TOKEN="YOUR_BOT_TOKEN" CHAT_ID="YOUR_CHAT_ID" THREAD_ID="YOUR_THREAD_ID" # Optional, for topic messages

โšก Quick Start

# Get the tools git clone https://github.com/Quasar-hub/quasar-server-sentinel.git # Go to directory cd quasar-server-sentinel # Make executable chmod +x *.sh # Update script variables nano check.sh nano ram_check.sh nano disk_check.sh # Set up crontab crontab -e # Add these lines: */5 * * * * $HOME/quasar-server-sentinel/check.sh <RPC_ENDPOINT> <VALIDATOR_ADDRESS> <CHAIN_ID> <CHAIN_NAME> [LOG_DIR] */5 * * * * $HOME/quasar-server-sentinel/ram_check.sh 0 */6 * * * $HOME/quasar-server-sentinel/disk_check.sh # Verify crontab crontab -l # Example: */5 * * * * $HOME/quasar-server-sentinel/check.sh http://localhost:26657 76A8A9A8151255E9E69E89499CFE9CB86FD cosmoshub-4 cosmos ./logs

๐Ÿ“ Monitoring Logs

Check your monitoring logs using these commands:

# Check RAM monitoring logs cat /var/log/syslog | grep "RAM Monitor" # Check Disk monitoring logs cat /var/log/syslog | grep "Disk Monitor"

โš™๏ธ Configuration

๐Ÿ“œ Missed Blocks Settings (click to expand)
# Script parameters RPC_ENDPOINT="$1" # Primary RPC endpoint (usually local) VALIDATOR_ADDRESS="$2" # Validator address in hex format 849ASD..... CHAIN_ID="$3" # Chain ID (e.g., cosmoshub-4, osmosis-1) CHAIN_NAME="$4" # Chain name for endpoint lookup (e.g., cosmoshub, osmosis) LOG_DIR="${5:-./logs}" # Directory for log files, default to ./logs if not provided
๐Ÿ’พ Disk Space Settings (click to expand)
# disk_check.sh configuration FREE_SPACE=100 # Alert when free space is below 100GB
๐ŸŽฎ RAM Settings (click to expand)
# ram_check.sh configuration USED_RAM=15 # Alert and reboot when RAM usage exceeds 15GB

๐Ÿ”” Alert Examples

๐Ÿšซ Missed Blocks

โš ๏ธ Alert: Validator Issues โ€ข Missed: 10 consecutive blocks โ€ข Chain: your_chain_id โ€ข Action: Check validator 

๐Ÿ’พ Storage Alert

โš ๏ธ Alert: Low Storage โ€ข Free: 95GB โ€ข Status: Warning โ€ข Action: Cleanup needed 

๐Ÿ”Œ Endpoint Failover

๐Ÿ”ด cosmoshub-4 - no response from primary or backup endpoints (tried 5 additional endpoints) on hostname 

๐Ÿ“Š System Status

๐Ÿ“Š Monitoring Schedule โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”‚ Service โ”‚ Frequency โ”‚ Next Check โ”‚ โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค โ”‚ Blocks Check โ”‚ 5 minutes โ”‚ Auto โ”‚ โ”‚ RAM Check โ”‚ 5 minutes โ”‚ Auto โ”‚ โ”‚ Disk Check โ”‚ 6 hours โ”‚ Auto โ”‚ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ 

๐Ÿ’ก Additional Resources

๐Ÿค Contributing

We welcome contributions! Check our Contributing Guide for details.

๐Ÿ› Report Bug ๐Ÿ”€ Pull Request ๐Ÿ’ก Suggest Feature

๐Ÿ“ˆ Resource Usage

System Impact: CPU: < 1% average usage RAM: ~ 50MB memory usage Disk: ~ 10MB for logs Network: ~ 1MB/hour 

โญ Support

If you find this useful:

  • ๐ŸŒŸ Star this repository
  • ๐Ÿ”„ Fork and contribute
  • ๐Ÿ“ข Share with others

๐Ÿ“œ License

MIT License โ€ข Free and Open Source


Made with โค๏ธ by Quasar ๐Ÿค–๐Ÿงฌ๐Ÿง  validator

๐Ÿ” Back to Top

About

A professional, lightweight monitoring solution for Cosmos Validators using pure Bash scripts for simplicity and minimal system overhead. Monitor missed blocks, RAM usage, disk space with Telegram notifications. No complex frameworks, no heavy dependencies - just efficient, reliable monitoring tools.

Topics

Resources

License

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published