Basic Resource Monitoring

    Essential commands and tools for monitoring system resources on your VPS

    Effective server monitoring is essential for maintaining a healthy, performant VPS. This guide covers the fundamental tools and techniques for monitoring system resources on your RamNode VPS, helping you identify bottlenecks, troubleshoot issues, and ensure optimal performance.

    Prerequisites

    • • A RamNode VPS with SSH access
    • • Root or sudo privileges
    • • Basic familiarity with the Linux command line

    CPU Monitoring

    Your CPU is the brain of your server. Monitoring CPU usage helps identify processes consuming excessive resources and potential performance bottlenecks.

    Using top

    The top command provides a real-time, dynamic view of system processes:

    Run top
    top

    Key metrics to watch in the top header include %us (user CPU), %sy (system CPU), %id (idle), and %wa (I/O wait). Press q to exit.

    Using htop

    For a more user-friendly interface, install and use htop:

    Install and run htop
    # Install htop
    sudo apt install htop         # Debian/Ubuntu
    sudo yum install htop         # CentOS/RHEL
    
    # Run htop
    htop

    htop displays color-coded CPU bars for each core, making it easy to identify load distribution across your VPS's vCPUs.

    Quick CPU Load Check

    For a quick snapshot of CPU load averages:

    Check load average
    uptime

    This displays three load averages representing 1, 5, and 15-minute intervals. As a general rule, load average should stay below the number of CPU cores available.

    Memory Monitoring

    Memory management is critical for server stability. Running out of memory can cause applications to crash or trigger the OOM killer.

    Using free

    The free command displays memory usage in a simple format:

    Check memory
    free -h

    The -h flag displays values in human-readable format (GB, MB).

    ColumnDescription
    totalTotal installed memory
    usedMemory currently in use by processes
    availableMemory available for new applications (includes cache)
    buff/cacheMemory used for disk caching (reclaimable)

    Finding Memory-Hungry Processes

    To identify processes consuming the most memory:

    Top memory consumers
    ps aux --sort=-%mem | head -10

    Disk Usage Monitoring

    Monitoring disk space prevents unexpected outages caused by full filesystems, which can crash databases and prevent logging.

    Using df

    The df command shows filesystem disk space usage:

    Check disk space
    df -h

    Focus on the Use% column. As a best practice, keep disk usage below 80% to maintain performance and leave room for unexpected growth.

    Using du

    To identify which directories are consuming the most space:

    Find large directories
    # Show largest directories in /var
    sudo du -h --max-depth=1 /var | sort -hr | head -10
    
    # Find large files (over 100MB)
    sudo find / -type f -size +100M -exec ls -lh {} \; 2>/dev/null

    Disk I/O Monitoring

    Use iostat to monitor disk I/O performance:

    Install and run iostat
    # Install sysstat package first
    sudo apt install sysstat      # Debian/Ubuntu
    
    # View I/O statistics
    iostat -x 1 5

    Watch the %util column—sustained values above 80% indicate disk I/O bottlenecks.

    Network Monitoring

    Network monitoring helps identify bandwidth usage patterns, potential security issues, and connectivity problems.

    Using vnstat

    vnstat provides network traffic statistics over time:

    Install and use vnstat
    # Install vnstat
    sudo apt install vnstat  # Debian/Ubuntu
    
    # View traffic summary
    vnstat
    
    # View live traffic
    vnstat -l

    Using iftop

    For real-time bandwidth monitoring per connection:

    Install and use iftop
    sudo apt install iftop
    sudo iftop -i eth0

    Active Connections

    To view current network connections:

    Check connections
    # List all connections
    ss -tuln
    
    # Count connections by state
    ss -s

    All-in-One Monitoring with vmstat and sar

    Using vmstat

    vmstat provides a comprehensive system overview:

    Run vmstat
    # Update every 2 seconds, 10 iterations
    vmstat 2 10
    ColumnMeaning
    rProcesses waiting for CPU time
    bProcesses in uninterruptible sleep (usually I/O)
    swpdAmount of swap memory used
    si/soSwap in/out—high values indicate memory pressure
    waCPU time spent waiting for I/O

    Using sar for Historical Data

    The sar utility (part of sysstat) collects and reports historical performance data:

    Enable and use sar
    # Enable data collection
    sudo systemctl enable sysstat
    sudo systemctl start sysstat
    
    # View CPU usage for today
    sar -u
    
    # View memory usage
    sar -r
    
    # View I/O statistics
    sar -d

    Quick Reference Commands

    Here's a summary of essential monitoring commands for quick reference:

    CommandPurpose
    top / htopReal-time process monitoring
    free -hMemory usage overview
    df -hDisk space usage
    iostat -x 1Disk I/O performance
    vmstat 1Overall system health snapshot
    vnstatNetwork traffic statistics
    ss -tulnActive network connections
    uptimeSystem uptime and load averages

    Monitoring Best Practices

    1
    Establish baselines: Monitor your server during normal operation to understand typical resource usage patterns before problems occur.
    2
    Set up automated monitoring: Consider implementing dedicated monitoring tools for continuous monitoring with alerting.
    3
    Monitor logs: Regularly check /var/log/syslog and /var/log/messages for errors and warnings.
    4
    Plan for growth: If you consistently approach resource limits, consider upgrading your VPS plan before performance degrades.
    5
    Document findings: Keep notes on performance issues and their resolutions for future reference.

    Automated Monitoring Solutions

    While the command-line tools above are great for quick checks and troubleshooting, for production environments you'll want automated monitoring with dashboards, alerting, and historical data. We have detailed deployment guides for several popular monitoring solutions:

    Grafana + Prometheus

    Industry-standard monitoring stack with beautiful dashboards and powerful alerting.

    Netdata

    Real-time performance monitoring with beautiful dashboards and zero configuration.

    Netdata Guide

    Uptime Kuma

    Self-hosted uptime monitoring with status pages and notifications.

    Uptime Kuma Guide

    Zabbix

    Enterprise-class open source monitoring for networks and applications.

    Zabbix Guide

    Nagios

    Industry-standard infrastructure monitoring with extensive plugin ecosystem.

    Nagios Guide

    Checkmk

    Enterprise-grade monitoring with auto-discovery and comprehensive dashboards.

    Checkmk Guide

    Next Steps

    Now that you understand basic monitoring, consider setting up automated monitoring with alerting. For persistent performance issues or questions about your VPS resources, contact RamNode support for assistance.