statistics. See the time command's man page for more details.

Nearly all graphical process-monitoring tools include some form of process control or management. Many of the early tools ported to Linux were clones of legacy UNIX utilities. One familiar monitoring (and control) program is top. Based on the ps command, the top command provides a text-based display of constantly updated console-based output showing the most CPU-intensive processes currently running. It can be started like this:

# top

After you press Enter, you see a display as shown in Figure 12.1. The top command has a few interactive commands: Pressing h displays the help screen; pressing k prompts you to enter the PID of a process to kill; pressing n prompts you to enter the PID of a process to change its nice value. The top man page describes other commands and includes a detailed description of what all the columns of information top can display actually represent; have a look at top's well-written man page.

FIGURE 12.1 The top command can be used to monitor and control processes. Here, we are prompted to renice a process.

The top command displays quite a bit of information about your system. Processes can be sorted by PID, age, CPU or memory use, time, or user. This command also provides process management, and system administrators can use its k and r keypress commands to kill and reschedule running tasks, respectively.

The top command uses a fair amount of memory, so you might want to be judicious in its use and not leave it running all the time. When you've finished with it, simply press q to quit top.

Displaying Free and Used Memory with free

Although top includes some memory information, the free utility displays the amount of free and used memory in the system in kilobytes (the -m switch displays in megabytes). On one system, the output looks like this:

# free

        total         used    free shared buffers cached

Mem:  1025368       995860   29508      0   56472 551464

-/+ buffers/cache:  387924  637444

Swap: 2031608            0 2031608

Swap:  433712            0  433712

This output describes a machine with 1GB of RAM memory and a swap partition of 2GB. Note that no swap is being used, although the machine is heavily loaded. Linux is very good at memory management and 'grabs' all the memory it can in anticipation of future work.

TIP

A useful trick is to employ the watch command; it repeatedly reruns a command every 2 seconds by default. If you use

# watch free

you can see the output of the free command updated every 2 seconds.

Another useful system-monitoring tool is vmstat (virtual memory statistics). This command reports on processes, memory, I/O, and CPU, typically providing an average since the last reboot; or you can make it report use for a current period by telling it the time interval in seconds and the number of iterations you desire, as follows:

# vmstat 5 10

The preceding command runs vmstat every 5 seconds for 10 iterations.

Use the uptime command to see how long it has been since the last reboot and to get an idea of what the load average has been; higher numbers mean higher loads.

Disk Quotas

Disk quotas are a way to restrict the use of disk space either by user or by groups. Although rarely — if ever — used on a local or standalone workstation, quotas are definitely a way of life at the enterprise level of computing. Use limits on disk space not only conserve resources, but also provide a measure of operational safety by limiting the amount of disk space any user can consume.

Disk quotas are more fully covered in Chapter 10, 'Managing Users.'

Graphical Process and System Management Tools

The GNOME and KDE desktop environments offer a rich set of network and system- monitoring tools. Graphical interface elements, such as menus and buttons, and graphical output, including metering and real-time load charts, make these tools easy to use. These clients, which require an active X session and (in some cases) root permission, are included with Fedora.

If you view the graphical tools locally while they are being run on a server, you must have X properly installed and configured on your local machine. Although some tools can be used to remotely monitor systems or locally mounted remote file systems, you have to properly configure pertinent X11 environment variables, such as $DISPLAY, to use the software or use the ssh client's -X option when connecting to the remote host.

Fedora no longer includes the xosview client, which provided load, CPU, memory and swap use, disk I/O use and activity, page-swapping information, network activity, I/O activity, I/O rates, serial port status, and if APM is enabled, the battery level (such as for a laptop). However, a great replacement is GKrellM, which provides a much neater interface and a host of additional plug-ins. You have to use this command to retrieve GKrellM:

# yum install gkrellm

After you have installed GKrellM, you can find it under Applications, System Tools. Figure 12.2 shows GKrellM.

FIGURE 12.2 GKrellM allows you to monitor most system processes on Fedora.

Graphical system- and process-monitoring tools that come with Fedora include the following:

vncviewer — AT&T's open source remote session manager (part of the Xvnc package), which can be used to view and run a remote desktop session locally. This software (discussed in more detail in Chapter 15, 'Remote Access with SSH') requires an active, background, X session on the remote computer.

gnome-nettool — A GNOME-developed tool that enables system

Добавить отзыв
ВСЕ ОТЗЫВЫ О КНИГЕ В ИЗБРАННОЕ

0

Вы можете отметить интересные вам фрагменты текста, которые будут доступны по уникальной ссылке в адресной строке браузера.

Отметить Добавить цитату