Previous page

Next page

Locate page in Contents

Print this page

Viewing Active Processes and Services

The vzps utility provides certain additional functionality related to monitoring separate Containers running on the host. For example, you can use the -E switch with the vzps utility to:

  • display the Container IDs where the processes are running
  • view the processes running inside a particular Container

vzps prints the information about active processes on your host. When run without any options, vzps lists only those processes that are running on the current terminal. Below is an example output of the vzps run:

# vzps

PID TTY TIME CMD

4684 pts/1 00:00:00 bash

27107 pts/1 00:00:00 vzps

Currently, the only processes assigned to the user/terminal are the bash shell and the vzps command itself. In the output, the PID (Process ID), TTY, TIME, and CMD fields are contained. TTY denotes which terminal the process is running on, TIME shows how much CPU time the process has used, and CMD is the name of the command that started the process.

Note: The IDs of the processes running inside Containers and displayed by running the vzps command on the host does not coincide with the IDs of the same processes shown by running the ps command inside these Containers.

As you can see, the standard vzps command just lists the basics. To get more details about the processes running on your server, you will need to pass some command line arguments to vzps. For example, using the aux arguments with this command displays processes started by other users (a), processes with no terminal or one different from yours (x), the user who started the process and when it began (u).

# vzps aux

USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND

root 1 0.0 0.0 1516 128 ? S Jul14 0:37 init

root 5 0.0 0.0 0 0 ? S Jul14 0:03 [ubstatd]

root 6 0.0 0.0 0 0 ? S Jul14 3:20 [kswapd]

#27 7 0.0 0.0 0 0 ? S Jul14 0:00 [bdflush]

root 9 0.0 0.0 0 0 ? S Jul14 0:00 [kinoded]

root 1574 0.0 0.1 218 140 pts/4 S 09:30 0:00 -bash

There is a lot more information now. The fields USER, %CPU, %MEM, VSZ, RSS, STAT, and START have been added. Let us take a quick look at what they tell us.

The USER field shows you which user initiated the command. Many processes begin at system start time and often list root or some system account as the USER. Other processes are, of course, run by individuals.

The %CPU, %MEM, VSZ, and RSS fields all deal with system resources. First, you can see what percentage of the CPU the process is currently utilizing. Along with CPU utilization, you can see the current memory utilization and its VSZ (virtual memory size) and RSS (resident set size). VSZ is the amount of memory the program would take up if it were all in memory; RSS is the actual amount currently in memory. Knowing how much a process is currently eating will help determine if it is acting normally or has spun out of control.

You will notice a question mark in most of the TTY fields in the vzps aux output. This is because most of these programs were started at boot time and/or by initialization scripts. The controlling terminal does not exist for these processes; thus, the question mark. On the other hand, the bash command has a TTY value of pts/4. This is a command being run from a remote connection and has a terminal associated with it. This information is helpful for you when you have more than one connection open to the machine and want to determine which window a command is running in.

STAT shows the current status of a process. In our example, many are sleeping, indicated by an S in the STAT field. This simply means that they are waiting for something. It could be user input or the availability of system resources. The other most common status is R, meaning that it is currently running.

Note: For detailed information on all vzps parameters, output fields, states of processes, etc., please consult the vzps manual pages.

You can also use the vzps command to view the processes inside any running Container. The example below shows you how to display all active processes inside Container 101:

# vzps -E 101

CTID PID TTY TIME CMD

101 27173 ? 00:00:01 init

101 27545 ? 00:00:00 syslogd

101 27555 ? 00:00:00 sshd

101 27565 ? 00:00:00 xinetd

101 27576 ? 00:00:03 httpd

101 27583 ? 00:00:00 httpd

101 27584 ? 00:00:00 httpd

101 27587 ? 00:00:00 crond

101 27596 ? 00:00:00 saslauthd