Translate

Tuesday 21 January 2014

Pstree

This is not the newest or most powerful command in AIX, and I know it won't be news to many people, however I do believe its power and simplicity are overlooked and it can be a great way to visualise how services such as the SRC (System Resource Controller) damon actually work.

Consider this example:

# ps -T 1835256
     PID    TTY  TIME CMD
 1835256      -  0:00 srcmstr
 1441898      -  0:00    |\--ksh
 3473544      -  0:00    |    \--tlmagent.bin
 2752612      -  0:00    |\--cimssys
 3276934      -  0:00    |\--cimssys
 3670134      -  0:00    |\--snmpdv3ne
 3866750      -  0:00    |\--sendmail
 4456486      -  0:00    |\--pmserviced
 4653200      -  0:00    |\--tftpd
 5374142      -  0:00    |    \--tftpd
 4718738      -  0:00    |\--inetd
 5898340      -  0:00    |    \--bootpd
 4849820      -  0:00    |\--xntpd
 4980896      -  0:00    |\--snmpmibd
 5177356      -  0:04    |\--rmcd
 5308630      -  0:00    |\--portmap
 5963950      -  0:00    |\--pnsd
 6029524      -  0:00    |\--nimesis
 6095064      -  0:00    |\--sshd
 6225990      -  0:00    |   |\--sshd
 3801168  pts/1  0:00    |   |    \--ksh
 9699392  pts/1  0:00    |   |        \--ps
 9044072      -  0:02    |    \--sshd
 8454202  pts/0  0:01    |        \--ksh
 5439694  pts/0  0:00    |            \--man
 3932274  pts/0  0:00    |                \--sh
 9437218  pts/0  0:00    |                    \--more
 6291580      -  0:00    |\--ksh
 7340090      -  0:00    |    \--ksh
 4915214      -  0:23    |        \--java
 6815790      -  0:00    |\--qdaemon
 1704024      -  0:00    |    \--ksh
 4325572      -  0:00    |        \--piohpnpf
 7405594      -  0:00    |\--IBM.HWCTRLRMd
 7667732      -  0:00    |\--ksh
 9175138      -  0:00    |    \--nonstop_aix
 7864320      -  0:39    |        \--java
 7733296      -  0:19    |\--java
 7930002      -  0:00    |\--writesrv
 8192066      -  0:00    |\--IBM.DRMd
 8257564      -  0:00    |\--IBM.CSMAgentRMd
 8388690      -  0:00    |\--hwsdagent
 8519766      -  0:00    |\--aso
 8650880      -  0:00    |\--IBM.AuditRMd
 8781936      -  0:00    |\--lpd
 8847384      -  0:00    |\--IBM.ServiceRMd
 8912930      -  0:00    |\--IBM.DMSRMd
 8978462      -  0:00    |\--pmloadcheck
 9633962      -  0:00     \--syslogd


You can clearly see each of the active subsystems ans child processes such as shell or Java, and this can be very useful when trying to diagnose system performance issues. You can also extend this functionality by installing the pstree RPM:

# wget http://www.oss4aix.org/download/RPMS/pstree/pstree-2.36-1.aix5.1.ppc.rpm
# rpm -Uvh ./pstree-2.36-1.aix5.1.ppc.rpm
pstree                      ##################################################

pstree enables you to see everything that is running on your system, and how processes relate to each other, and this helps you to identify things that should not be running e.g.

# pstree
-+- 00001 root /etc/init
 |--= 524354 root aioPpool
 |--- 1376382 root [4]ldmp_process
 |--- 1507478 root /usr/ccs/bin/shlap64
 |--= 1638530 root [2]kbiod
 |--= 1769576 root aioLpool
 |--= 1900694 root /usr/lib/errdemon
 |--- 2031730 root [17]/usr/sbin/syncd 60
 |--= 2097274 root efs_tkr_gc
 |--- 2424924 root ethchanproc
 |--- 3014860 root random
 |--= 3080408 root /opt/ibm/icc/cimom/bin/dirsnmpd
 |--- 3145902 root /opt/ibm/director/cimom/bin/tier1slp
 |-+= 3276968 root /usr/sbin/srcmstr
 | |--= 2293910 root /usr/sbin/snmpmibd
 | |--= 2555958 root /usr/sbin/portmap
 | |--= 2818118 root /usr/sbin/xntpd
 | |--= 3408008 root /usr/sbin/inetd
 | |--= 3473518 root /usr/sbin/syslogd -r
 | |--= 3604590 root sendmail: accepting connections
 | |-+= 3932308 root [2]/usr/sbin/tftpd -n
 | | \--= 3866836 nobody /usr/sbin/tftpd -n

 | |--= 4063364 root /usr/sbin/aso

....
...

This machine is a NIM Master so I need tftpd to provide network boot images, otherwise this daemon should not be active!

No comments:

Post a Comment