The following example lists all the running applications on all the running servers on each node of each cell.
1 #---------------------------------------------------------------- 2 # lines 4 and 5 find all the cell and process them one at a time 3 #---------------------------------------------------------------- 4 set cells [$AdminConfig list Cell] 5 foreach cell $cells { 6 #----------------------------------------------------------------------- 7 # lines 10 and 11 find all the nodes belonging to the cell and 8 # process them at a time 9 #----------------------------------------------------------------------- 10 set nodes [$AdminConfig list Node $cell] 11 foreach node $nodes { 12 #-------------------------------------------------------------- 13 # lines 16-20 find all the running servers belonging to the cell 14 # and node, and process them one at a time 15 #-------------------------------------------------------------- 16 set cname [$AdminConfig showAttribute $cell name] 17 set nname [$AdminConfig showAttribute $node name] 18 set servs [$AdminControl queryNames type=Server,cell=$cname,node=$nname,*] 19 puts "Number of running servers on node $nname: [llength $servs]" 20 foreach server $servs { 21 #--------------------------------------------------------- 22 # lines 25-31 get some attributes from the server to display; 23 # invoke an operation on the server JVM to display a property. 24 #--------------------------------------------------------- 25 set sname [$AdminControl getAttribute $server name] 26 set ptype [$AdminControl getAttribute $server processType] 27 set pid [$AdminControl getAttribute $server pid] 28 set state [$AdminControl getAttribute $server state] 29 set jvm [$AdminControl queryNames type=JVM,cell=$cname,node=$nname,process=$sname,*] 30 set osname [$AdminControl invoke $jvm getProperty os.name] 31 puts " $sname ($ptype) has pid $pid; state: $state; on $osname" 32 j3 #--------------------------------------------------------- 34 # line 37-42 find the applications running on this server and 35 # display the application name. 35 #--------------------------------------------------------- 37 set apps [$AdminControl queryNames type=Application,cell=$cname,node=$nname,process=$sname,*] 38 puts " Number of applications running on $sname: [llength $apps]" 39 foreach app $apps { 40 set aname [$AdminControl getAttribute $app name] 41 puts " $aname" 42 } 43 puts "----------------------------------------------------" 44 puts "" 45 46 } 47 } 48 }
Number of running servers on node mynode: 2 mynode (NodeAgent) has pid 3592; state: STARTED; on Windows 2000 Number of applications running on mynode: 0 ---------------------------------------------------- server1 (ManagedProcess) has pid 3972; state: STARTED; on Windows 2000 Number of applications running on server1: 0 ---------------------------------------------------- Number of running servers on node mynodeManager: 1 dmgr (DeploymentManager) has pid 3308; state: STARTED; on Windows 2000 Number of applications running on dmgr: 2 adminconsole filetransfer ----------------------------------------------------