Parallels Virtuozzo Containers 4.6 for Linux


Add to my manuals
384 Pages

advertisement

Parallels Virtuozzo Containers 4.6 for Linux | Manualzz

Managing Services and Processes 192

Managing Processes and Services

In Parallels Virtuozzo Containers, services and processes can be managed by using both the command line and Parallels Management Console. In the command line, you can manage the corresponding processes and services by using the following utilities:

 vzps

 vzpid

 vztop

 vzsetxinetd.

With their help, you can perform the following tasks:

 Print information about active processes on your Hardware Node.

 Display the processes activity in real time.

 Change the mode of the services that can be either xinetd-dependent or standalone.

 Identify the Container ID where a process is running by the process ID.

Parallels Management Console allows you to manage the services present in the Host Operating

System of the Hardware Node or in a Container. It allows you to monitor (and partially configure) the services of the Host operating system at the Hardware Node. By using

Management Console, you can start, stop, restart a service, or edit its run levels.

Below in this chapter detailed information on all those tasks that can be performed by means of the command line utilities and Parallels Management Console is given.

Managing Services and Processes 193

Viewing Active Processes and Services

The vzps utility can be run on the Hardware Node just as the standard Linux ps utility. It provides certain additional functionality related to monitoring separate Containers running on the Node, namely, 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 information about active processes on your Hardware Node. 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: Starting with Virtuozzo 3.0, the IDs of the processes running inside Containers and displayed by running the vzps command on the Hardware Node 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 Hardware Node, 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). Besides, you can pass vzps the -E switch, which is specific for Parallels Virtuozzo Containers, to sort the processes by the

Container IDs where they are running.

# vzps aux -E

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.

Managing Services and Processes 194

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.

In the current version of Parallels Virtuozzo Containers, you can also use the vzps command to view the processes currently running inside any Containers on the Hardware Node. 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

In its turn, Parallels Management Console allows you to monitor the services present in the Host

Operating System of the Hardware Node or inside a Container. Click on the

Services item in the tree below the Hardware Node name. The list of the Host OS or Container OS services should appear in the right pane:

Managing Services and Processes 195

Figure 33: Management Console - Viewing Services

The way the services are colored reflects the importance of a service for Parallels Virtuozzo

Containers: pink icons are for services that are critical for Parallels Virtuozzo Containers and yellow icons are for services that are not that critical.

Running services are indicated with bright icons. Stopped services have shaded icons. The

Status column of the table duplicates this information in the text form. The default run levels of services are ticked off in the corresponding table columns.

To facilitate working with services, you can sort them by different parameters: their name, status, etc. Just click the column with the appropriate name to put services in the desired order.

Managing Services and Processes 196

Monitoring Processes in Real Time

The vztop utility is rather similar to vzps but is usually started full-screen and updates continuously with process information. This can help with programs that may infrequently cause problems and can be hard to see with vzps. Overall system information is also presented, which makes a nice place to start looking for problems.

The vztop utility can be run on the server just as the standard Linux top utility. The only features that distinguish the vztop utility from top are the following:

 vztop allows you to use the -E option that monitors only the processes belonging to the

Container whose processes you want to display.

 You can use the e interactive command to temporarily view/hide the CTIDs where the processes are running.

 You can use the E interactive command to set the filter on the CTID field that helps you display only the processes belonging to the given Container.

The vztop utility usually has an output like the following:

# vztop -E 101

17:54:03 up 20 days, 23:37, 4 users, load average: 2.13, 1.89, 1.75

305 processes: 299 sleeping, 3 running, 3 zombie, 0 stopped

CPU0 states: 20.1% user 51.2% system 0.0% nice 0.0% iowait 28.1% idle

CPU1 states: 21.2% user 50.0% system 0.0% nice 0.0% iowait 28.1% idle

Mem: 1031088k av, 969340k used, 61748k free, 0k shrd, 256516k buff

509264k active, 330948k inactive

Swap: 4056360k av, 17156k used, 4039204k free 192292k cached

CTID PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND

101 27173 root 16 0 1616 604 1420 S 0.0 0.1 0:01.86 init

101 27545 root 16 0 1520 624 1356 S 0.0 0.1 0:00.34 syslogd

101 27555 root 25 0 4008 1700 3632 S 0.0 0.4 0:00.04 sshd

101 27565 root 25 0 2068 860 1740 S 0.0 0.2 0:00.05 xinetd

101 27576 root 16 0 7560 3180 6332 S 0.0 0.7 0:03.78 httpd

101 27587 root 16 0 2452 1036 1528 S 0.0 0.2 0:00.34 crond

101 27596 root 25 0 4048 1184 3704 S 0.0 0.2 0:00.01 saslauthd

As you can see, vztop provides an ongoing look at the processor activity in real time (the display is updated every 5 seconds by default, but you can change that with the d command-line option or the s interactive command). It displays a list of the most CPU-intensive tasks on the system and can provide an interactive interface for manipulating processes. It can sort the tasks by CPU usage, memory usage, and runtime. Specifying 101 after the -E option allows you to display only those processes that are running inside Container 101 only. Besides, most features can be selected by an interactive command, for example, the e and E commands described above.

Note: For more information on all vztop parameters, consult its man pages. Besides, you can find information on some fields in the

Viewing Active Processes subsection (p. 193).

In Parallels Management Console, you can view those processes that are currently running on your Hardware Node and/or inside your Container(s). To display the processes, click the

Hardware Node name where you wish to monitor processes and then select

Monitor > Processes.

A list of the Host OS or Container OS processes should appear in the right pane:

Managing Services and Processes 197

Figure 34: Management Console - Monitoring Active Processes

The column names and their description is presented in the table below:

Column name

pid

%cpu

%mem ni pri rss stat time user veid

Description

The identifier of the process.

The CPU time, in percent, used by the process.

The memory used by the process.

The 'nice' parameter; weights the overall scheduling priority for the process.

The kernel scheduling priority for the process.

Number of resident pages for the swap-out guarantee (the resident set size).

The process current status. Can be 'R' (running), 'S' (sleeping, waiting for 'wake-up call)', 'D' (uninterruptable sleep), 'Z' (zombie, waiting for parent process), 'T' (stopped or traced). Sometimes the second symbol may appear: 'W' (process swapping), 'N' ('niced' process), 'L' (process has pages locked into memory). If the < sign is displayed after the status, it means that this information was returned by the Parallels

Agent software which, in turn, got this information from the ps tool.

The total CPU time the process has used.

The user who has launched the process.

The ID of the Container where the process is running.

Managing Services and Processes 198

command The command that invoked the process.

To view the processes inside a Container, double-click on its name and select

Monitor >

Processes.

Note: Starting with Virtuozzo 3.0, the IDs of the processes running inside your Containers displayed by selecting

Monitor > Processes on the Hardware Node does not coincide with the

IDs of the same processes shown when opening the Container Manager window and selecting

Monitor > Processes.

You can send different signals to process by right-clicking a process and selecting the corresponding signal on the pop-up menu.

Managing Services and Processes 199

Changing Services Mode

xinetd

is a service used to start and stop a variety of data communication services. xinetd starts on the Hardware Node startup and waits for a connection request from a remote client that wants to connect to the server. There can be a number of remote clients in the network, and each of them can use different network protocols to establish connection to the server. In order not to run all network services responsible for a specific protocol, which will negatively influence the system performance, the system starts only the xinetd service. This service controls all other network services and, at the connection time, it starts the corresponding service to process this connection. In such a way, xinetd saves system resources allowing you to run only those network services in the system that are really needed at the moment.

The vzsetxinetd utility allows you to switch Container services between the standalone and xinetd

mode. The services that can be either standalone or dependent on xinetd are sendmail

, sshd, proftpd, and courier-imap. Whereas they are xinetd-dependent by default, in order to consume less resources, you may want to make them standalone due to the following reasons:

 The CPanel application does not recognize sshd if it is dependent on xinetd.

 sendmail does not process some rules correctly if it is dependent on xinetd.

 A number of control panel applications and some others are not able to manage xinetdbased services at all.

The courier-imapd, courier-imapds, courier-pop3d, and courier-pop3ds services are provided by the courier-imap service, thus vzsetxinetd can manage these services via the courier-imap service.

Let us assume that you wish to check the mode of the sendmail service and set it to standalone if it is in the xinetd mode. First, you should check the current status of the sendmail service. To this effect, type the following command in the command line:

# vzsetxinetd -s 222 sendmail

where 222 is the Container ID, sendmail denotes the name of the corresponding service, and the -s option gets the status of the sendmail service of the Container with ID 222. The output will tell you if this service has the standalone or xinetd mode: sendmail is xinetd service

In our case it is in the xinetd mode. Now you can change the mode of the sendmail service to standalone. To make it standalone, type the following line:

# vzsetxinetd 222 sendmail off

sendmail is standalone service where off specifies that the sendmail service should be set to the standalone mode. The output confirms that the sendmail service is now standalone.

For more information on the vzsetxinetd utility, please consult the corresponding man pages or turn to the Parallels Virtuozzo Containers 4.6 Reference Guide.

Note: You cannot use the vzsetxinetd utility to change the mode of the xinetd-dependent services in Containers where the Debian 3.0 OS template is installed.

Managing Services and Processes 200

Determining Container Identifier by Process ID

Each process is identified by a unique PID (process identifier), which is the entry of that process in the kernel's process table. For example, when you start Apache, it is assigned a process ID.

This PID is then used to monitor and control this program. The PID is always a positive integer.

In Parallels Virtuozzo Containers, you can use the vzpid (retrieve process ID) utility to print the Container ID the process with the given id belongs to. Multiple process IDs can be specified as arguments. In this case the utility will print the Container number for each of the processes.

The typical output of the vzpid utility is shown below:

# vzpid 12

Pid VEID Name

12 101 init

In our example the process with the identifier 12 has the name 'init' and is running in the

Container with ID 101.

Note: You can also display the Container ID where the corresponding process is running by using the vzps utility.

Managing Services and Processes 201

Starting, Stopping, and Restarting Services

Parallels Management Console allows you to manage the services present in the Host Operating

System of the Hardware Node or in a Container. Click the

Services item in the tree below the

Hardware Node nameor the Container name. A list of the Host OS or Container OS services should appear in the right pane:

Figure 35: Management Console - Managing Processes and Services

To start, stop, or restart a service, select its line in the table and either use the pop-up menu or the buttons on the toolbar. For xinetd-dependent services (the services having xinetd in parentheses beside their name), you do not start and stop but enable and disable services. The services enabled in this way are started and stopped on the basis of the corresponding state of the xinetd daemon. Disabled services are not started whatever the xinetd state.

To edit the default run levels for the service, use the

Properties item on the context menu or just double–click on the service name within the list. When the

Properties dialog is open, select the check boxes of the run levels on which the service will start automatically. Click the

OK button to apply your settings. If the service is dependent on xinetd, you cannot choose its run levels, as the latter are determined by the xinetd daemon. Besides, you cannot change run levels for certain services, which means that they are critical and you are not allowed to change their run levels.

You can also manage (i.e. start, stop, and restart) services by using the command line. For example, you wish to start the httpd service. To do this, execute the following command:

[root@ct222 /]# service httpd start

Managing Services and Processes 202

where service is the standard Linux command, httpd denotes the name of the corresponding service, and start is the command that will launch this service. In order to check that the httpd service was successfully launched, you can either type the following

Linux command:

[root@ct222 /]# service httpd status

or use the vzps utility when working on your server or the ps utility when working inside your

Containers and passing them the x argument. The output will tell you if the httpd service is running in your system or not.

advertisement

Was this manual useful for you? Yes No
Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Related manuals

advertisement

Table of contents