Command macro to display process data from a set of processes

Blue Bar separator

The other day I needed to trace all processes running the Apache web server. The processes all have the same name, httpd, which I thought would make it easy but it turned out not to be. There is an analyze_system request to execute a second request against all processes but not a subnet of processes. The following command macro provides that capability.

Usage

 ----------------------------- display_process_set ----------------------------
 match_string:                                  
 request_string_1:        
 request_string_2:        
 request_string_3:        
 request_string_4:                 
 request_string_5:       
match_string
A string used to select which processes to display. The list is created by executing the analyze_system request "match match_string; who" so any string, for example process or user name can be used.

request_string_1
A string containing an analyze_system request to execute.

request_string_2
A string containing an analyze_system request to execute, it can be left blank.

request_string_3
A string containing an analyze_system request to execute, it can be left blank.

request_string_4
A string containing an analyze_system request to execute, it can be left blank.

request_string_5
A string containing an analyze_system request to execute, it can be left blank.

Notes

Output from each process is separated by a block of several lines of asterisk characters.

Timing is everything and it is possible for a process to terminate between the time that the process list is created and the requests are executed. When that happens you will see an error message "Process not found" and the previous process' data is displayed again.

This macro makes use of attach_default_output when creating the process list. If you terminate the macro while the list is being created you will have to manually execute the detach_default_output command.

This macro relies on the analyze_system prompt being "as: " if it has been changed you will need to adjust the macro. Also when run as a started process the macro turns off abbreviations. If the macro is run interactively you must be sure that none of your abbreviations overlap and commands or requests. I know that I can put an explanation point character (!) in front of the commands but that character can create problems when using the RSN software to transfer the macro so I don't use it.

Examples

Example 1

This first example matches on "http"; which is the first part of the process name "httpd". The request being executed is "trace". I have truncated the trace output to reduce the size of the example.

display_process_set http trace
OpenVOS Release 17.0.2ah, analyze_system Release 17.0.2ah
Current process is 466, ptep 8C22F040, Noah_Davids.CAC
as:  as:  ******************************************************
as:  ******************************************************
as:  ******************************************************
as:  ******************************************************
as:  Using nonrunning process.
Current process is 107, ptep 8DF0E180, root.root (httpd)
as:  switch_process       sp: 7FFF88C0  pc: 80064040 (ia32_switch_process+40)
give_up_cpu          sp: 7FFF88F0  pc: 801FB86B (give_up_cpu_i+18EB, line 1304)
suspend_process_event2_real
                     sp: 7FFF89E0  pc: 801FBE59 (suspend_resume_i+579, line 191)
task_wait_event_util_real
                     sp: 7FFF8A70  pc: 801F4249 (event+6339, line 1948)
          On-units at 00000000
waf_handler          sp: 7FFF8D50  pc: 800600B5 (ia32_waf_and_sis+B5)
          On-units at 7FFF8D60
. . . 
Trace complete.
as:  as:  as:  as:  as:  ******************************************************
as:  ******************************************************
as:  ******************************************************
as:  ******************************************************
as:  Using nonrunning process.
Current process is 108, ptep 8DFB8B40, root.root (httpd)
as:  switch_process       sp: 7FFF88C0  pc: 80064040 (ia32_switch_process+40)
give_up_cpu          sp: 7FFF88F0  pc: 801FB86B (give_up_cpu_i+18EB, line 1304)
suspend_process_event2_real
                     sp: 7FFF89E0  pc: 801FBE59 (suspend_resume_i+579, line 191)
task_wait_event_util_real
                     sp: 7FFF8A70  pc: 801F4249 (event+6339, line 1948)
          On-units at 00000000
waf_handler          sp: 7FFF8D50  pc: 800600B5 (ia32_waf_and_sis+B5)
          On-units at 7FFF8D60
. . . 
Trace complete.
as:  as:  as:  as:  as:  ******************************************************
as:  ******************************************************
as:  ******************************************************
as:  ******************************************************
as:  Using nonrunning process.
Current process is 110, ptep 8DFC88C0, root.root (httpd)
as:  switch_process       sp: 7FFF88C0  pc: 80064040 (ia32_switch_process+40)
give_up_cpu          sp: 7FFF88F0  pc: 801FB86B (give_up_cpu_i+18EB, line 1304)
suspend_process_event2_real
                     sp: 7FFF89E0  pc: 801FBE59 (suspend_resume_i+579, line 191)
task_wait_event_util_real
                     sp: 7FFF8A70  pc: 801F4249 (event+6339, line 1948)
          On-units at 00000000
waf_handler          sp: 7FFF8D50  pc: 800600B5 (ia32_waf_and_sis+B5)
          On-units at 7FFF8D60
. . .
Trace complete.
as:  as:  as:  as:  as:  ******************************************************
as:  ******************************************************
as:  ******************************************************
as:  ******************************************************
as:  Using nonrunning process.
Current process is 111, ptep 8DF354C0, nobody.nobody (httpd)
as:  switch_process       sp: 7FFF88C0  pc: 80064040 (ia32_switch_process+40)
give_up_cpu          sp: 7FFF88F0  pc: 801FB86B (give_up_cpu_i+18EB, line 1304)
suspend_process_event2_real
                     sp: 7FFF89E0  pc: 801FBE59 (suspend_resume_i+579, line 191)
task_wait_event_util_real
                     sp: 7FFF8A70  pc: 801F4249 (event+6339, line 1948)
          On-units at 00000000
waf_handler          sp: 7FFF8D50  pc: 800600B5 (ia32_waf_and_sis+B5)
          On-units at 7FFF8D60
. . .
Trace complete.
as:  as:  as:  as:  as:  ready  12:46:48

Example 2

In this example two requests are executed, trace and dump_pte again the output is truncated to reduce space.

display_process_set http trace dump_pte
OpenVOS Release 17.0.2ah, analyze_system Release 17.0.2ah
Current process is 466, ptep 8C22F040, Noah_Davids.CAC
as:  as:  ******************************************************
as:  ******************************************************
as:  ******************************************************
as:  ******************************************************
as:  Using nonrunning process.
Current process is 107, ptep 8DF0E180, root.root (httpd)
as:  switch_process       sp: 7FFF88C0  pc: 80064040 (ia32_switch_process+40)
give_up_cpu          sp: 7FFF88F0  pc: 801FB86B (give_up_cpu_i+18EB, line 1304)
suspend_process_event2_real
                     sp: 7FFF89E0  pc: 801FBE59 (suspend_resume_i+579, line 191)
task_wait_event_util_real
                     sp: 7FFF8A70  pc: 801F4249 (event+6339, line 1948)
          On-units at 00000000
waf_handler          sp: 7FFF8D50  pc: 800600B5 (ia32_waf_and_sis+B5)
          On-units at 7FFF8D60
. . .
Trace complete.
as:  PTE at 8DF0E180 for root.root (httpd)
 process_id:             550F806B
 process_number:         107
 max_priority:           7
 max_processes:          0
. . .
as:  as:  as:  as:  ******************************************************
as:  ******************************************************
as:  ******************************************************
as:  ******************************************************
as:  Using nonrunning process.
Current process is 108, ptep 8DFB8B40, root.root (httpd)
as:  switch_process       sp: 7FFF88C0  pc: 80064040 (ia32_switch_process+40)
give_up_cpu          sp: 7FFF88F0  pc: 801FB86B (give_up_cpu_i+18EB, line 1304)
suspend_process_event2_real
                     sp: 7FFF89E0  pc: 801FBE59 (suspend_resume_i+579, line 191)
task_wait_event_util_real
                     sp: 7FFF8A70  pc: 801F4249 (event+6339, line 1948)
          On-units at 00000000
waf_handler          sp: 7FFF8D50  pc: 800600B5 (ia32_waf_and_sis+B5)
          On-units at 7FFF8D60
. . .
Trace complete.
as:  PTE at 8DFB8B40 for root.root (httpd)
 process_id:             550F806C
 process_number:         108
 max_priority:           7
 max_processes:          0
. . .

Example 3

Using the match request within the request line is possible

display_process_set http 'match # ; list_port_attachments' 
OpenVOS Release 17.0.2ah, analyze_system Release 17.0.2ah
Current process is 466, ptep 8C22F040, Noah_Davids.CAC
as:  as:  ******************************************************
as:  ******************************************************
as:  ******************************************************
as:  ******************************************************
as:  Using nonrunning process.
Current process is 107, ptep 8DF0E180, root.root (httpd)
as:  Pathname:            %phx_vos#null
Pathname:            %phx_vos#m15_mas>process_dir_dir>pd.550F806B>_aat8atL4IHKeb
+qtb.temp
Pathname:            %phx_vos#null
Pathname:            %phx_vos#null
Pathname:            %phx_vos#stcp.m15_48
Pathname:            %phx_vos#m15_mas>process_dir_dir>pd.550F806B>_aat8atL4IHKeb
+qs-.temp
Pathname:            %phx_vos#m15_mas>process_dir_dir>pd.550F806B>_aat8atL4IHKeb
+qs-.temp
. . .
as:  as:  as:  as:  as:  ******************************************************
as:  ******************************************************
as:  ******************************************************
as:  ******************************************************
as:  Using nonrunning process.
Current process is 108, ptep 8DFB8B40, root.root (httpd)
as:  Pathname:            %phx_vos#m15_mas>process_dir_dir>pd.550F806B>_aat8atL4
+IHKebqtb.temp
Pathname:            %phx_vos#null
Pathname:            %phx_vos#null
Pathname:            %phx_vos#null
Pathname:            %phx_vos#m15_mas>system.17.0>apache2>logs>error_log.1279670
+400
Pathname:            %phx_vos#m15_mas>system.17.0>apache2>bin>rotatelogs.pm
Pathname:            %phx_vos#m15_mas>system.17.0>error_codes.text
Pathname:            %phx_vos#null
Pathname:            %phx_vos#m15_mas>system.17.0>apache2>logs>httpd.out
as:  as:  as:  as:  as:  ******************************************************
as:  ******************************************************
as:  ******************************************************
as:  ******************************************************
as:  Using nonrunning process.
Current process is 110, ptep 8DFC88C0, root.root (httpd)
as:  Pathname:            %phx_vos#m15_mas>process_dir_dir>pd.550F806B>_aat8atL4
+IHKebqtk.temp
Pathname:            %phx_vos#m15_mas>process_dir_dir>pd.550F806B>_aat8atL4IHKeb
+qtb.temp
Pathname:            %phx_vos#null
Pathname:            %phx_vos#null
Pathname:            %phx_vos#m15_mas>process_dir_dir>pd.550F806B>_aat8atL4IHKeb
+qtb.temp
Pathname:            %phx_vos#m15_mas>system.17.0>apache2>bin>rotatelogs.pm
Pathname:            %phx_vos#m15_mas>system.17.0>error_codes.text
Pathname:            %phx_vos#null
Pathname:            %phx_vos#m15_mas>system.17.0>apache2>logs>httpd.out
as:  as:  as:  as:  as:  ******************************************************
as:  ******************************************************
as:  ******************************************************
as:  ******************************************************
as:  Using nonrunning process.
Current process is 111, ptep 8DF354C0, nobody.nobody (httpd)
as:  Pathname:            %phx_vos#null
Pathname:            %phx_vos#m15_mas>process_dir_dir>pd.550F806B>_aat8atL4IHKeb
+qtb.temp
Pathname:            %phx_vos#null
Pathname:            %phx_vos#null
Pathname:            %phx_vos#stcp.m15_48
Pathname:            %phx_vos#m15_mas>process_dir_dir>pd.550F806B>_aat8atL4IHKeb
+qs-.temp
Pathname:            %phx_vos#m15_mas>process_dir_dir>pd.550F806B>_aat8atL4IHKeb
+qs-.temp
. . . 

Example 4

While the command does execute interactively it typically generates a lot of output and I really expect that most of the time it will run as a started process. Don't forget to include the -privileged argument in the start_process command. This is needed to run analyze_system.

start_process 'display_process_set http trace dump_pte dump_tdr (string dump_eve
+nts -attached)' -privileged -output_path x.out
ready  13:17:12
d x.out

%phx_vos#m15_mas>SysAdmin>Noah_Davids>x.out  10-07-24 13:17:16 mst

Noah_Davids.CAC logged in on %phx_vos#m15 at 10-07-24 13:17:12 mst.
display_process_set http trace dump_pte dump_tdr (string dump_events -attached)
OpenVOS Release 17.0.2ah, analyze_system Release 17.0.2ah
Current process is 471, ptep 8C1F2400, Noah_Davids.CAC (display_process_set)
as:
as:  ******************************************************
as:  ******************************************************
as:  ******************************************************
as:  ******************************************************
as:  Using nonrunning process.
Current process is 107, ptep 8DF0E180, root.root (httpd)
as:  switch_process       sp: 7FFF88C0  pc: 80064040 (ia32_switch_process+40)
give_up_cpu          sp: 7FFF88F0  pc: 801FB86B (give_up_cpu_i+18EB, line 1304)
suspend_process_event2_real
                     sp: 7FFF89E0  pc: 801FBE59 (suspend_resume_i+579, line 191)
task_wait_event_util_real
                     sp: 7FFF8A70  pc: 801F4249 (event+6339, line 1948)
          On-units at 00000000
waf_handler          sp: 7FFF8D50  pc: 800600B5 (ia32_waf_and_sis+B5)
          On-units at 7FFF8D60
. . .
Trace complete.
as:  PTE at 8DF0E180 for root.root (httpd)
 process_id:             550F806B
 process_number:         107
 max_priority:           7
 max_processes:          0
. . . 
as:
TDR @ 40000080

    Flags:
           tasking_enabled ignore_preemption
           scheduler_hook_valid

    n_tasks                  1
    current_task_num         1
    n_static_tasks           1
    max_n_tasks              33
    stack_base               7FE60000
    stack_len                32768
    first_task_static_ptr    002B5000
. . . 
as:
EVENT_ID_TABLE at 7FEE1780 for root.root (httpd)
 Event_no     ETEP     Name
   1        8DFC8040   ''
   2        8DF51BC0*  File httpd.out
   3        8DC935C0*  File error_codes.text
   4        8DEA5D80*  File httpd.pm
   5        8DF18A40   File _aat8atL4IHKebqs-.temp
   6        8C1DCA40   File _aat8atL4IHKebqtb.temp
   7        8DEA5E00   ''
   8        8C217D40   File _aat8atL4IHKebqtk.temp
   9        8DFC3080   ''
   10       8DFBD640   File apr0YZsVf
   11       8DFC7BC0   File apr0YZsVf
   12       8DF36880   File accept.lock.1427079275
   13       8DFC6780   ''
   14       8DFC2140   ''
   15       8DFB8AC0   ''
   16       8DFB3440   ''
   17       8DFB4900   ''
   18       8DFDEC80   ''
   19       8DFB7540   ''
   20       8DFB4780   ''
   21       8DFB62C0   ''
   22       8DF9EA00   ''
   23       8C1DE540   ''
   24       8DFE4F00   ''
as:  as:  ******************************************************
as:  ******************************************************
as:  ******************************************************
as:  ******************************************************
as:  Using nonrunning process.
Current process is 108, ptep 8DFB8B40, root.root (httpd)
as:  switch_process       sp: 7FFF88C0  pc: 80064040 (ia32_switch_process+40)
give_up_cpu          sp: 7FFF88F0  pc: 801FB86B (give_up_cpu_i+18EB, line 1304)
suspend_process_event2_real
                     sp: 7FFF89E0  pc: 801FBE59 (suspend_resume_i+579, line 191)
task_wait_event_util_real
                     sp: 7FFF8A70  pc: 801F4249 (event+6339, line 1948)
          On-units at 00000000
waf_handler          sp: 7FFF8D50  pc: 800600B5 (ia32_waf_and_sis+B5)
          On-units at 7FFF8D60
. . .

Example 5

Including the match request in a started process is tricky because of the semi-colon. You can insert the semi-colon via the byte command function.

start_process 'display_process_set http (string match login (byte 3Bx) dump_pte)
+' -privileged -output_path x.out
ready  13:10:46
d x.out

%phx_vos#m15_mas>SysAdmin>Noah_Davids>x.out  10-07-24 13:10:49 mst

Noah_Davids.CAC logged in on %phx_vos#m15 at 10-07-24 13:10:46 mst.
display_process_set http (string match login (byte 3Bx) dump_pte)
OpenVOS Release 17.0.2ah, analyze_system Release 17.0.2ah
Current process is 470, ptep 8C1E3000, Noah_Davids.CAC (display_process_set)
as:
as:  ******************************************************
as:  ******************************************************
as:  ******************************************************
as:  ******************************************************
as:  Using nonrunning process.
Current process is 107, ptep 8DF0E180, root.root (httpd)
as:  PTE at 8DF0E180 for root.root (httpd)
 login_time:             39788A93 (10-07-21 10:38:27 mst)
as:  as:  as:  as:  as:  ******************************************************
as:  ******************************************************
as:  ******************************************************
as:  ******************************************************
as:  Using nonrunning process.
Current process is 108, ptep 8DFB8B40, root.root (httpd)
as:  PTE at 8DFB8B40 for root.root (httpd)
 login_time:             39788A95 (10-07-21 10:38:29 mst)
. . .
Process finished.

Example 6

All the previous examples matched on a process name but it is possible to match on other things, like user name.

start_process 'display_process_set noah (string match login (byte 3Bx) dump_pte)
+' -privileged -output_path x.out
ready  15:16:10
d x.out

%phx_vos#m15_mas>SysAdmin>Noah_Davids>x.out  10-07-24 15:16:14 mst

Noah_Davids.CAC logged in on %phx_vos#m15 at 10-07-24 15:16:10 mst.
HElooooooooooo
display_process_set noah (string match login (byte 3Bx) dump_pte)
OpenVOS Release 17.0.2ah, analyze_system Release 17.0.2ah
Current process is 479, ptep 8C1F2400, Noah_Davids.CAC (display_process_set)
as:
as:  ******************************************************
as:  ******************************************************
as:  ******************************************************
as:  ******************************************************
as:  process 466
as:  Using nonrunning process.
Current process is 466, ptep 8C22F040, Noah_Davids.CAC
as:  PTE at 8C22F040 for Noah_Davids.CAC (login)
 login_time:             397C704B (10-07-24 09:35:23 mst)
as:  as:  as:  as:  as:  ******************************************************
as:  ******************************************************
as:  ******************************************************
as:  ******************************************************
as:  process 479
as:  Using process on CPU1.
Current process is 479, ptep 8C1F2400, Noah_Davids.CAC (display_process_set)
Process is running on CPU 1 right now; no stack addr known.
as:  PTE at 8C1F2400 for Noah_Davids.CAC (display_process_set)
 login_time:             397CC02A (10-07-24 15:16:10 mst)
as:  as:  as:  as:  as:
Process finished.

Example 7

The macro has arguments for 5 requests but what if you want to execute more? You can place multiple requests in 1 argument by separating them with a semi-colon.

display_process_set http 'dump_pte ; dump_tdr'
OpenVOS Release 17.0.2ah, analyze_system Release 17.0.2ah
Current process is 466, ptep 8C22F040, Noah_Davids.CAC
as:  as:  ******************************************************
as:  ******************************************************
as:  ******************************************************
as:  ******************************************************
as:  process 107
as:  Using nonrunning process.
Current process is 107, ptep 8DF0E180, root.root (httpd)
as:  PTE at 8DF0E180 for root.root (httpd)
 process_id:             550F806B
 process_number:         107
 max_priority:           7
 max_processes:          0
. . . 

TDR @ 40000080

    Flags:
           tasking_enabled ignore_preemption
           scheduler_hook_valid

    n_tasks                  1
    current_task_num         1
    n_static_tasks           1
    max_n_tasks              33
    stack_base               7FE60000
    stack_len                32768
    first_task_static_ptr    002B5000
    first_task_static_len    152156
. . .

as:  as:  as:  as:  as:  ******************************************************
as:  ******************************************************
as:  ******************************************************
as:  ******************************************************
as:  process 108
as:  Using nonrunning process.
Current process is 108, ptep 8DFB8B40, root.root (httpd)
as:  PTE at 8DFB8B40 for root.root (httpd)
 process_id:             550F806C
 process_number:         108
 max_priority:           7
 max_processes:          0
. . . 

TDR @ 40000080

    Flags:
           tasking_enabled ignore_preemption
           scheduler_hook_valid

    n_tasks                  1
    current_task_num         1
    n_static_tasks           1
    max_n_tasks              33
    stack_base               7FE60000
    stack_len                32768
    first_task_static_ptr    00071000
    first_task_static_len    21680
. . .
ready  04:51:19

Example 8

If you are going to use a started process the semi-colon must be entered using the byte command function.

start_process 'display_process_set http (string dump_pte (byte 3Bx) dump_tdr)'
+-privileged -output_path x.out                                               
ready  04:55:57
d x.out

%phx_vos#m15_mas>SysAdmin>Noah_Davids>x.out  10-07-26 04:56:00 mst

Noah_Davids.CAC logged in on %phx_vos#m15 at 10-07-26 04:55:57 mst.
HElooooooooooo
display_process_set http (string dump_pte (byte 3Bx) dump_tdr)
OpenVOS Release 17.0.2ah, analyze_system Release 17.0.2ah
Current process is 482, ptep 8C22B200, Noah_Davids.CAC (display_process_set)
as:
as:  ******************************************************
as:  ******************************************************
as:  ******************************************************
as:  ******************************************************
as:  process 107
as:  Using nonrunning process.
Current process is 107, ptep 8DF0E180, root.root (httpd)
as:  PTE at 8DF0E180 for root.root (httpd)
 process_id:             550F806B
 process_number:         107
 max_priority:           7
 max_processes:          0
 . . . 

display_process_set.cm


& display_process_set begins here
&
& display_process_set.cm
&   version 1.0 10-07-20
&   version 1.1 10-11-26 Added disclaimer
& noah.davids@stratus.com
&
& This software is provided on an "AS IS" basis, WITHOUT ANY WARRANTY OR ANY
& SUPPORT OF ANY KIND. The AUTHOR SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES
& OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE.  This disclaimer
& applies, despite any verbal representations of any kind provided by the
& author or anyone else.
&
&begin_parameters
MATCH match_string:string
REQUEST1 request_string_1:string
REQUEST2 request_string_2:string
REQUEST3 request_string_3:string
REQUEST4 request_string_4:string
REQUEST5 request_string_5:string
&end_parameters
&
&echo no_input_lines no_command_lines no_macro_lines
&if (process_type) ^= interactive
&then &do
set_ready -format off
use_abbreviations -off
&end
&
&attach_input
&set_string LIST (process_dir)>display_process_set_list
analyze_system
..attach_default_output &LIST&
match &MATCH&; who
..detach_default_output
&set LINE 1
&label AGAIN
&set_string PROCESS (translate (contents &LIST& &LINE& -hold) '_{}' ' ()')
&if &PROCESS& = 'as:__' &then &goto NEXT1
&if &LINE& = 1 &then &+
    &set_string PROC (translate (substr &PROCESS& 6 5) '  ' '_*')
&else &set_string PROC (translate (substr &PROCESS& 1 5) '  ' '_*')
..display_line ******************************************************
..display_line ******************************************************
..display_line ******************************************************
..display_line ******************************************************
..display_line process &PROC&
process &PROC&
&
&REQUEST1&
&REQUEST2&
&REQUEST3&
&REQUEST4&
&REQUEST5&
&
&set LINE (calc &LINE& + 1)
&goto AGAIN
&
&label NEXT1
&set_string line (contents &LIST& 1 -close)
quit
&
& display_process_set ends here                                                 



Blue Bar separator
This page was last modified on 10-11-26
mailbox Send comments and suggestions
to noad.davids@stratus.com