Wednesday 7 December 2016

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.

No comments:

Post a Comment