Installing and Administering N1 Grid Console - Container Manager 1.0

Moving or Starting Processes in a Container

If the application being managed by the container does not have a unique executable name, then you will want to move processes into the container manually. This method ensures you track only the processes of the desired application. You have the following options for moving processes into a container:

To Move Processes Into an Application-Based Container Individually

Use this procedure if you did not provide a match expression for an application-based container definition and want to move the application's processes into the container individually.

  1. Create an application-based container definition for managing the application. Select the checkbox Do Not Use Match Expression.

    For detailed steps, see To Create an Application-Based Container Definition.

  2. Review the/etc/project file to determine the project name for the container by typing:


    % cat /etc/project
    

    You will need this project name in Step 5.

  3. If needed, start the application in a terminal window.

  4. Determine the processes corresponding to the application.

    For examples of how to do this, see Example 3–1, Example 3–2, and Example 3–3.

  5. Move the corresponding processes by typing:


    # newtask -p project_name -c pid
    

    where project_name is the corresponding name found in the /etc/project file and pid is the process ID of the process to be moved.

    You must move each process one at a time.

  6. Repeat Step 5 until all processes are moved.


Example 3–4 Moving ORACLE Processes Individually

The following example shows how to use the command ps with egrep to identify ORACLE processes associated with an application named AcctEZ. These three processes (17773, 17763, 17767) will be moved into a container named Accounting with the newtask -p command. The project name for this container is named payroll, which has been verified in the /etc/project file.


% ps -cafe | egrep 'UID|ora_'
     UID   PID  PPID  CLS PRI    STIME TTY      TIME CMD
 smcorau 17773     1  FSS  28 14:55:25 ?        0:00 ora_reco_AcctEZ
 smcorau 17763     1  FSS  59 14:55:24 ?        0:00 ora_pmon_AcctEZ
 smcorau 17767     1  FSS  59 14:55:25 ?        0:00 ora_lgwr_AcctEZ
% newtask -p payroll -c 17773
% newtask -p payroll -c 17763
% newtask -p payroll -c 17767


Example 3–5 Verifying That the Processes Were Moved Into the Container With ps

You can use the ps command in combination with grep to verify that the processes have been moved into a container. The following is an example showing that the processes moved individually in Example 3–4 are now in the container payroll:


% ps -ae -o pid,project,comm | grep payroll
17773    payroll ora_reco_AcctEZ 
17763    payroll ora_pmon_AcctEZ 
17767    payroll ora_lgwr_AcctEZ 


Example 3–6 Verifying That the Processes Were Moved Into the Container With prstat

You can use the command prstat to verify that the processes were moved into a container if you know the project name. In this example, the project name is payroll.


% prstat -J payroll
   PID USERNAME  SIZE   RSS STATE  PRI NICE      TIME  CPU PROCESS/NLWP       
 17773 admin     216M  215M cpu2     1    0   0:05:08  29% ora_reco_AcctEZ/1
 17763 admin     834M  782M sleep    1    0   0:35:02   0% ora_pmon_AcctEZ/1
 17767 admin     364M  352M run      1    0   0:22:05  23% ora_lgwr_AcctEZ/1							

To Start an Application in a Container
  1. Create an application-based container definition for managing the application. Select the checkbox Do Not Use Match Expression.

    For detailed steps, see To Create an Application-Based Container Definition.

  2. Select from the following according to the OS version:

    • For the Solaris 8 OS, type:


      % srmuser user_name newtask -p project_name application_name
      

      where user_name is the UNIX user name, and project_name is in the form user.username. In the Solaris 8 OS, since only the user-based container is supported, user_name and project_name will be the same.

    • For the Solaris 9 OS, type:


      % newtask -p project_name application_name
      

      where project_name is the project associated with the container, and application_name is the command that starts the application, including any command arguments.

    The application is started in the container.


Example 3–7 Starting an Application Inside a Container on Solaris 9 OS

The following is an example of starting an application named tracks inside a container named music:


% newtask -p music tracks -z 0 mozart.au

where -z 0 mozart.au are the command line arguments for the application tracks.



Example 3–8 Verifying Which Project an Application is Associated

After the application has been started, you can verify which project the application is associated with by typing:


% ps -ae -o pid,project,comm

The following is an example of the output from this command:


  PID  PROJECT COMMAND
...
17771   default ora_smon_SunMC
16246   system rquotad
26760   group.staff /bin/csh
16266   music	 tracks
17777   default ora_d000_SunMC
17775   default ora_s000_SunMC
17769   default ora_ckpt_SunMC

In this example, the application named tracks has PID 16266, the project is music, and the executable is tracks. This is the same application started in Example 3–7.