System Load and CPU Monitoring
1. Check System Uptime & Load
- Displays:
- Current time
- System uptime
- Logged-in users
- Load averages (1, 5, 15 min)
2. Real-Time Process Monitoring
- Shows:
- Active processes
- CPU & memory usage
- PID, user, priority, %CPU, %MEM
3. System Statistics
- 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
- Shows CPU usage for all processors.
5. Historical CPU Usage
- 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
- Displays:
- Total, used, free, shared, buff/cache, available memory.
- Includes Mem and Swap sections.
-h → human-readable format.
2. Detailed Memory Info
- 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
- Displays memory segments for a given process ID.
5. Kernel Slab Cache Usage
- Real-time view of kernel object caching.
- Exit:
q.
6. Check Swap Usage
- 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
- Displays:
- Total, used, and available space for each mounted filesystem.
-h → human-readable format.
2. Disk Usage by Directory
- 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
- 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
sudo dnf install iotop -y
- Shows per-process disk I/O usage.
- Exit:
q.
5. Real-Time Disk & Network Stats
sudo dnf install dstat -y
- Displays:
- Disk I/O
- Network stats
- System-level metrics
- Stop:
Ctrl+C.
6. Block-Level I/O Stats
- Shows raw kernel data for disk activity (read/write counts, sectors processed).
7. List Mounted Filesystems
- 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.