Monitor statistics such as:
Memory usage
CPU usage
Input/Output (I/O) usage
Delay times
Queuing
CentOS 7 uses the /proc file system for monitoring system performance.
Access via the cat
command with various kernel parameters.
Definition: A pseudo-file system that interfaces directly with the kernel and exists in memory.
Kernel Parameters Sample:
Table 12-2 provides a partial listing of kernel values. For full listings, check proc
man page.
Entry Descriptions:
iomem
: Memory input/output statistics
mounts
: Mounted file system statistics
stat
: Process status in readable format, detailing process resource usage.
diskstats
: Disk statistics providing read/write performance metrics.
swaps
: Swap file statistics (similar to virtual memory in Windows 10), indicating swap memory usage.
loadavg
: Average number of processes ready to run over the last 1, 5, and 15 minutes.
System-related tasks include:
Viewing performance and memory info for optimization purposes.
Viewing or modifying runtime parameters, allowing for dynamic resource adjustment.
Viewing hardware information for diagnostics.
Viewing network parameters to monitor traffic and connectivity.
Viewing statistical information to help in resource planning.
Command Overview:
Navigate to /proc directory:bash cd /proc
List files in /proc:bash ls
Retrieve performance information:
System and file system stats:bash cat stat cat mounts
Disk stats:bash cat diskstats
Swap, load averages, and I/O memory usage:bash cat swaps cat loadavg cat iomem
Functionality: Displays system statistics in real-time (default 5-second update).
Basic Usage:
Command: top
Displays top CPU processes and their resource utilization.
Key Fields in top Output:
uptime
: System up time and average loads for 1, 5, and 15 minutes.
processes
: Total processes running and their resource demands.
CPU states
: Breakdown of CPU time across modes:
User mode
System mode
Nice tasks
iowait (waiting for I/O)
Idle time
Mem
: Total, free, used memory, shared memory, buffers providing a snapshot of memory health.
Swap
: Total, available, used swap space.
PID
: Process ID for ongoing tasks.
PPID
: Parent process ID for hierarchical process management.
UID
: User ID of the task’s owner.
USER
: Username of the task's owner, facilitating accountability.
SHARE
: Shared memory used by the task.
To start top with custom iterations:
Command: top -n 5 -d 10.00
Note: This command uses significant memory; use it judiciously for troubleshooting. Press q
to exit and return to command prompt.
Functionality: Displays amounts of free and used memory, including swap, crucial for memory management.
Output shows in kilobytes by default; use -m
to view in megabytes for easier interpretation.
Command: free
Functionality: Repeatedly runs free
to show real-time memory statistics and system health.
Default refresh every two seconds; can control the interval for flexibility.
Command: watch free
Terminate with Ctrl+C
. This allows users to monitor changes continuously and adapt to performance needs.
Overview: Reports on process status, memory consumption, paging activity, I/O operations, and CPU usage, providing a comprehensive view of system performance.
Execution: For average stats since last reboot or specific intervals, aiding in detailed performance analysis:
Command syntax: vmstat [time] [iterations]
Example: vmstat 5 10
(reporting every 5 seconds for 10 iterations) to track system performance trends over time.
Key Fields in vmstat Output:
procs
: Running and sleeping processes for overall system workload.
swap
: Amount of memory paged for I/O, signifying active memory management.
us
: Percentage of CPU time used in user space, indicating application performance.
sy
: Percentage of CPU time used by the kernel, reflecting the system's operational workload.
wa
: Percentage of CPU time spent in I/O wait, highlighting bottleneck areas.
id
: Percentage of CPU time spent idle, giving insight into overall system utilization.
Functionality: Displays system uptime, CPU average load for 1, 5, and 15 minutes, active user