Dieser Inhalt ist in der von Ihnen ausgewählten Sprache nicht verfügbar.
3.5. Built-in Command-line Monitoring Tools
In addition to graphical monitoring tools, Red Hat Enterprise Linux provides several tools that can be used to monitor a system from the command line. The advantage of these tools is that they can be used outside run level 5. This section discusses each tool briefly, and suggests the purposes to which each tool is best suited.
top
The top tool provides a dynamic, real-time view of the processes in a running system. It can display a variety of information, including a system summary and the tasks currently being managed by the Linux kernel. It also has a limited ability to manipulate processes. Both its operation and the information it displays are highly configurable, and any configuration details can be made to persist across restarts.
By default, the processes shown are ordered by the percentage of CPU usage, giving an easy view into the processes that are consuming the most resources.
For detailed information about using top, refer to its man page:
man top
.
ps
The ps tool takes a snapshot of a select group of active processes. By default this group is limited to processes owned by the current user and associated with the same terminal.
It can provide more detailed information about processes than top, but is not dynamic.
For detailed information about using ps, refer to its man page:
man ps
.
vmstat
vmstat (Virtual Memory Statistics) outputs instantaneous reports about your system's processes, memory, paging, block I/O, interrupts and CPU activity.
Although it is not dynamic like top, you can specify a sampling interval, which lets you observe system activity in near-real time.
For detailed information about using vmstat, refer to its man page:
man vmstat
.
sar
sar (System Activity Reporter) collects and reports information about today's system activity so far. The default output covers today's CPU utilization at ten minute intervals from the beginning of the day:
12:00:01 AM CPU %user %nice %system %iowait %steal %idle 12:10:01 AM all 0.10 0.00 0.15 2.96 0.00 96.79 12:20:01 AM all 0.09 0.00 0.13 3.16 0.00 96.61 12:30:01 AM all 0.09 0.00 0.14 2.11 0.00 97.66 ...
This tool is a useful alternative to attempting to create periodic reports on system activity through top or similar tools.
For detailed information about using sar, refer to its man page:
man sar
.
3.5.1. Getting Information about Pages paged in and Pages paged out
You can use both the
vmstat
utility and the sar
utility to get the information about Pages paged in
(PGPGIN) and Pages paged out
(PGPGOUT). Pages paged in
are the blocks of data recorded to the memory. Pages paged out
are the blocks of data recorded from the memory.
In case of
vmstat
, use the -s
option:
~]$ vmstat -s
This command shows PGPGIN and PGPGOUT as saved in the
/proc/vmstat
file on the lines beginning with pgpgin
and pgpgout
.
- PGPGIN are the blocks of data recorded from any location to the memory
- PGPGOUT are the blocks of data recorded from the memory to any location
The output values represent the total value of PGPGIN or PGPGOUT from the start of the system run to the current moment in kilobytes.
In case of
sar
, use the -B
option:
~]$ sar -B
- PGPGIN are the blocks of data recorded from disks to the memory
- PGPGOUT are the blocks of data recorded from the memory to disks
You can set the time resolution of the calculation in the
/var/log/sa/sadd
file, where dd
is the day in the month. For example, you can choose to get the average values for all 10-minute periods from the system start to the current moment. The resulting values are in kilobytes per second.