Page cover

Monitoring and Logging Essentials

Efficiently monitoring and managing logs is essential for maintaining validator node performance. Here are the main tools and commands for this task:

  • System Monitoring:

    • htop – Real-time view of processes, CPU, and memory usage.

    • ps aux – Lists all running processes with details like CPU and memory usage.

    • free -h – Shows memory usage in a human-readable format.

    • df -h – Displays disk usage and available space.

  • Log Management:

    • journalctl -u nodename.service – Shows logs for a specific systemd service.

    • tail -f /path/to/logfile – Shows the end of a file and updates in real time, useful for monitoring logs as they are written.

    • logrotate – Used to configure log rotation and prevent log files from using up disk space.

  • Log Analysis:

    • grep "keyword" /path/to/logfile – Searches logs for specific keywords.

    • awk '{print $1, $2, $5}' /path/to/logfile – Extracts specific fields from logs for easier analysis.

  • Example Health Check Script with Alerts:

    bashCopy code#!/bin/bash
    if ! systemctl is-active --quiet nodename.service; then
        echo "Node down" | mail -s "Node Alert" [email protected]
    fi

Last updated

Was this helpful?