Skip to content
Menu

RHSA: Analyzing Servers

System Load and CPU Monitoring

1. Check System Uptime & Load

uptime
  • Displays:
    • Current time
    • System uptime
    • Logged-in users
    • Load averages (1, 5, 15 min)

2. Real-Time Process Monitoring

top
  • Shows:
    • Active processes
    • CPU & memory usage
    • PID, user, priority, %CPU, %MEM

3. System Statistics

vmstat 2 5
  • Updates every 2 seconds, 5 times.
  • Displays:
    • Processes
    • Memory
    • Swap
    • I/O
    • CPU usage

4. CPU Usage per Processor

  • Install sysstat if needed:
sudo dnf install sysstat -y
  • Command:
mpstat -P ALL
  • Shows CPU usage for all processors.

5. Historical CPU Usage

sar -u 1 3
  • Collects CPU stats every 1 second, 3 times.
  • Displays:
    • User time
    • System time
    • Idle time
    • Average at end

6. Top CPU-Consuming Processes

ps -eo pid,ppid,cmd,%mem,%cpu --sort=-%cpu | head
  • Lists:
    • PID, PPID, command, %MEM, %CPU
  • Sorted by CPU usage (top 10 by default).

RHCSA Exam Tips

  • Understand load averages from uptime.
  • Use top for real-time monitoring.
  • Know vmstat, mpstat, and sar for performance analysis.
  • Use ps for CPU/memory-heavy processes.
  • Be familiar with installing sysstat for mpstat and sar.

Analyze memory usage and allocation


Key Commands & Their Purpose

1. Check Memory Usage

free -h
  • Displays:
    • Total, used, free, shared, buff/cache, available memory.
    • Includes Mem and Swap sections.
  • -h → human-readable format.

2. Detailed Memory Info

cat /proc/meminfo
  • Shows low-level details:
    • MemTotal, MemFree, Buffers, Cached, SwapTotal, etc.

3. Top Memory-Consuming Processes

ps aux --sort=-%mem | head -10
  • Lists top 10 processes by memory usage.

4. Memory Map of a Process

pmap <PID>
  • Displays memory segments for a given process ID.

5. Kernel Slab Cache Usage

slabtop
  • Real-time view of kernel object caching.
  • Exit: q.

6. Check Swap Usage

swapon --show
  • Displays active swap partitions and usage details.

7. Check Hugepages

cat /proc/sys/vm/nr_hugepages
  • Shows number of hugepages allocated (often 0 by default).

RHCSA Exam Tips

  • Understand free -h output (Mem vs Swap).
  • Know /proc/meminfo for detailed stats.
  • Use ps aux and pmap for process-level memory analysis.
  • Be familiar with slabtop for kernel memory.
  • Check swap and hugepages for advanced memory management.

Analyzing Disk space

Goal

Analyze disk space usage and I/O performance in RHEL.


Key Commands & Their Purpose

1. Check Disk Space

df -h
  • Displays:
    • Total, used, and available space for each mounted filesystem.
  • -h → human-readable format.

2. Disk Usage by Directory

du -sh /var/*
  • Shows size of each subdirectory in /var.
  • -s → summary only.
  • -h → human-readable.

3. I/O Statistics

  • Install sysstat if needed:
sudo dnf install sysstat -y
  • Command:
iostat -xz 1 5
  • Options:
    • -x → extended stats.
    • -z → omit inactive devices.
    • 1 5 → update every 1 sec, 5 times.
  • Displays:
    • CPU usage
    • Device throughput
    • I/O wait time

4. Real-Time Disk I/O by Process

  • Install iotop if needed:
sudo dnf install iotop -y
  • Command:
sudo iotop
  • Shows per-process disk I/O usage.
  • Exit: q.

5. Real-Time Disk & Network Stats

  • Install dstat if needed:
sudo dnf install dstat -y
  • Command:
dstat -dny
  • Displays:
    • Disk I/O
    • Network stats
    • System-level metrics
  • Stop: Ctrl+C.

6. Block-Level I/O Stats

cat /sys/block/sda/stat
  • Shows raw kernel data for disk activity (read/write counts, sectors processed).

7. List Mounted Filesystems

mount | column -t
  • Displays all mounted filesystems in a neat column format.

RHCSA Exam Tips

  • Know df and du for disk space analysis.
  • Use iostat, iotop, and dstat for I/O performance monitoring.
  • Understand /sys/block/<device>/stat for low-level disk metrics.
  • Be familiar with installing sysstat, iotop, and dstat utilities.

Leave a Reply

Your email address will not be published. Required fields are marked *