/
***********************************************************************
*****/ /* Document : UNIX command examples, mainly based on
Solaris, AIX, HP */ /* and ocourse, also !inux" */ /* Doc" #ersion
: $$% */ /* &ile : unix"txt */ /* Purpose : some examples or
t'e (racle, D), S+!Serer D)A */ /* Date : -.-.--0 */ /* 1ompiled by
: Albert an der Sel */ /* )est use : Use ind/searc' in your editor
to ind a strin2, command, */ /* or any identiier */ /
***********************************************************************
*****/
33333333333333333333333333333333333333333333 S415I(N $" 1(66ANDS 5(
74574I#4 S8S546 IN&(:
33333333333333333333333333333333333333333333
99999999999999999999999999 $" H( 5( ;45 S8S546 IN&(:
99999999999999999999999999
$"$ S'ort ersion: 999999999999999999
See section $" or more detailed commands and options"
6emory: AIX: bootino r lsattr 4 l mem- lsattr 4 l
sys- a realmem smon ; mstat mo !
lparstat i or use a tool as <topas< or <nmon<
=t'ese are utilities>
HP: 2etmem 2rep 6em5otal /proc/memino dmes2 ? 2rep i
p'ys
@c c /de/mem or us a tool as <2lance<, lie enterin2
<2lance m< rom prompt =is a utility> Solaris: prtcon ?
2rep <6emory siBe< 3 total memory prtmem memps
m 5ruC: mstat P ? 2rep <5otal P'ysical 6emory< uer ?
2rep memory
S@ap:
AIX: lsps a lsps s pstat s HP: s@apino a
Solaris: s@ap l prts@ap l !inux: s@apon s cat
/proc/s@aps cat /proc/memino
cpu:
HP: ioscan n1 processor 2etcon 1PUE#47SI(N 2etcon
1PUE1HIPE58P4 model
AIX: lparstat =i> prtcon ? 2rep proc
pmcycles m lsattr 4l procx =x is -,, etc"">
lsc2 ? 2rep proc pstat S mpstat
!inux: cat /proc/cpuino
prtdia2
!inux: cat /proc/ersion
Solaris: uname a cat /etc/release =or ot'er @ay to ie@ t'at
ile, lie <more /etc/release<> 5ruC: /usr/sbin/siBer
AIX: osleel r =only 'i2'leel ersion> osleel s =s'o@s
#ersion, SP, 5! leel> osleel Fs =s'o@s complete
'istory> lslpp ' bos"rte
AIX 4xample:
3 osleel Fs no@n Serice Pacs %G----G-G$ %G----- %G----$-$0
%G--------- %G---.-%-G$ %G---.--$ %G---.-G-$$ %G---.---C %G---.-$-.
%G---C--G$ %G---C-.-$ %G---C-C-$$ %G---C-%--C %G---C--. %G---C-G-.G
%G---C--.. %G---C-$-. %G---%1SP---- %G---%-C---- %G---%-%----
%G---%----- %G---%-G---- %G---%----- %G---%-$---- %G---1SP----
%G----G---- %G-------- %G----$---- %G---G1SP----
AIX irm@are:
lsmcode c display t'e system irm@are leel and serice processor
lsmcode r d scraid- display t'e adapter microcode leels or a 7AID
adapter scraid- lsmcode A display t'e microcode leel or all
supported deices prtcon s'o@s many settin2 includin2 memory,
irm@are, serial3 etc""
Notes about Po@er or % lpars:
&or AIX: 5'e uname ! command identiies a partition on a
system @it' multiple !PA7S" 5'e !PA7 id can be useul or @ritin2
s'ell scripts t'at customiBe system
settin2s suc' as IP address or 'ostname"
5'e output o t'e command loos lie:
3 uname ! $ lpar-$
5'e output o uname ! aries by maintenance leel" &or consistent
output across maintenance leels, add a s la2" &or illustrate,
t'e ollo@in2 command assi2ns t'e
partition number to t'e ariable <lparEnumber< and partiton
name to <lparEname<"
&or HPUX: Use commands lie <parstatus< or
<2etcon PA75I5I(NEID4N5< to 2et npar inormation"
patc'es:
AIX: Is a certain ix =APA7> installedJ instix i
APA7Enumber instix a i APA7Enumber
5o determine your platorm irm@are leel, at t'e command prompt,
type:
lsc2 p ? 2rep p Platorm
5'e last six di2its o t'e 7(6 leel represent t'e platorm
irm@are date in t'e ormat, 8866DD"
p2ino i paca2eEname 5ruC: /usr/sbin/dupatc' trac type
it
Netcards:
AIX: lsde 1c adapter lsde 1c adapter ? 2rep ent
lsde 1c i lsattr 4 l ent$ iconi2 a Solaris:
prtcon D / prtcon p / prtcon ? 2rep <card< prtdia2 ?
2rep <card< scs x iconi2 a =up plumb>
+uicly ind out @'o is usin2 most memory:
See section mared KKK =use ind/searc' on KKK>
Net@or sniin2:
Here are a e@ s'ort descriptions, and examples, o useull net@or
trace / dump commands"
Solaris:
snoop command examples:
&or example, i @e @ant to obsere traic bet@een systems alp'a
and beta @e can use t'e ollo@in2 command: 3 snoop alp'a,beta 5o
enable data captures rom t'e snoop output @it'out losin2 pacets
@'ile @ritin2 to t'e screen, send t'e snoop output to a ile"
&or example: 3 snoop o /tmp/snooper # $"%-"$"%- 5o snoop a
speciic port: 3 snoop o port xxx
AIX:
A 2ood @ay to use tcpdump is to sae t'e net@or trace to a ile @it'
t'e @ la2 and t'en analyBe t'e trace by usin2 dierent ilterin2
options to2et'er @it' t'e r la2" 5'e ollo@in2 example s'o@ 'o@ to
run a basic tcpdump net@or trace, sain2 t'e output in a ile @it'
t'e @ la2 =on a 4t'ernet net@or interace>: 3 tcpdump @
/tmp/tcpdump"en- i en-
5o limit t'e number o traced pacets, use t'e c la2 and speciy t'e
number, suc' as in t'e ollo@in2 example t'at traces t'e irst $
pacets =on a toenrin2 net@or interace>: 3 tcpdump c $ @
/tmp/tcpdump"tr- i tr-
iptrace command examples:
5o start t'e iptrace daemon @it' t'e System 7esource 1ontroller
=S71>, 3 startsrc s iptrace a </tmp/nettrace<
5o stop t'e iptrace daemon @it' S71 enter t'e ollo@in2: 3 stopsrc s
iptrace
5o record pacets comin2 in and 2oin2 out to any 'ost on eery
interace, enter t'e command in t'e ollo@in2 ormat: 3 iptrace
/tmp/nettrace
5'e recorded pacets are receied on and sent rom t'e local 'ost" All
pacet lo@ bet@een t'e local 'ost and all ot'er 'osts on any
interace is recorded" 5'e trace inormation is placed into t'e
/tmp/nettrace ile"
5o record pacets receied on an interace rom a speciic remote 'ost,
enter t'e command in t'e ollo@in2 ormat: 3 iptrace i en- p telnet s
airmail /tmp/telnet"trace
5'e pacets to be recorded are receied on t'e en- interace, rom
remote 'ostairmail, oer t'e telnet port" 5'e trace inormation is
placed into t'e /tmp/telnet"trace ile"
5o record pacets comin2 in and 2oin2 out rom a speciic remote 'ost,
enter t'e command in t'e ollo@in2 ormat: 3 iptrace i en- s airmail
b /tmp/telnet"trace
5'e pacets to be recorded are receied on t'e en- interace, rom
remote 'ost airmail" 5'e trace inormation is placed into t'e
/tmp/telnet"trace ile"
HPUX:
!o22in2 is enabled or all subsystems as determined by t'e
/etc/nettl2en"con ile" !o2 messa2es are sent to a lo2 ile @'ose
name is determined by addin2 t'e suix "!(;--- to t'e lo2 ile name
speciied in t'e /etc/nettl2en"con coni2uration ile"
5o stop t'e tracin2 acility: 3 nettl stop
5urn on inbound and outbound PDU tracin2 or t'e transport and
session =(5S/0---> subsystems and send binary trace messa2es to
ile /ar/adm/trace"571---" 3 nettl traceon pduin pduout entity
transport session L
ile /ar/adm/trace
Session usin2 nettl and t'e ormatter netmt: $" 1apture pacets nettl
tn all e nsElsEip tm 00000 siBe $- somera@captureile
" 7eproduce problem"
G" 5urn o trace: nettl t e all
" 1reate ormatter ilter ile" 4xample: ilter tcpEsport CC00 ilter
tcpEdport CC00
%" &ilter t'e pacets: %"$ <!on2< display netmt Nlnc
ilterile somera@"capture M ormatted"out %" <(neliner< display
netmt Nln$5c ilterile somera@"capture M oneliner"out
7estart inetd, ns:
Startin2 and stoppin2 N&S:
(n all unixes, a number o daemons s'ould be runnin2 in order or
N&S to be unctional, lie or example t'e rpc"* processes, biod,
nsd and ot'ers"
(nce ns is runnin2, and in order to actually <s'are< or
<export< your ilesystem on your serer, so remote clients are
able to mount t'e ns mount, in most cases you s'ould edit t'e
</etc/exports< ile"
AIX: 5'e ollo@in2 subsystems are part o t'e ns 2roup: nsd, biod,
rpc"locd, rpc"statd, and rpc"mountd" 5'e ns subsystem =2roup> is
under control o t'e <resource controller<, so startin2 and
stoppin2 ns is actually easy
3 startsrc 2 ns
(r use smitty"
7ed'at !inux: 3 /sbin/serice ns restart 3 /sbin/serice ns start 3
/sbin/serice ns stop
(n some ot'er !inux distros 3 /etc/init"d/ns start 3 /etc/init"d/ns
stop 3 /etc/init"d/ns restart
Solaris: I t'e ns daemons arent runnin2, t'en you @ill need to run:
3 /etc/init"d/ns"serer start
HPUX: Issue t'e ollo@in2 command on t'e N&S serer to start all
t'e necessary N&S processes =HP>: 3 /sbin/init"d/ns"serer
start
(r i your mac'ine is only a client: 3 cd /sbin/init"d 3 "/ns"client
start
7estart or reres' inetd ater you 'ae edited
<inetd"con<:
Ater you 'ae edited </etc/inetd"con<, or example, to enable
or disable some serice, you need to restart, or reres' inetd, to
read t'e ne@ coni2uration inormation" 5o let inetd to reread t'e
coni2ile:
AIX: 3 reres' s inetd
HPUX: 3 /usr/sbin/inetd c
Solaris: 3 /etc/init"d/inetd stop 3 /etc/init"d/inetd start 3 pill
HUP inetd 3 5'e command @ill restart t'e inetd and reread t'e
coni2uration"
7edHat / !inux 3 serice xinetd restart or 3 /etc/init"d/inetd
restart
$" 6ore Detail:
$""$ S'o@ memory in Solaris: 99999999999999999999999999999
prtcon: Use t'is command to obtain detailed system inormation about
your Sun Solaris installation 3 /usr/sbin/prtcon
3 prtcon Displays t'e siBe o t'e system memory and reports
inormation about perip'eral deices
Use t'is command to see t'e amount o memory: 3 /usr/sbin/prtcon ?
2rep <6em<
sysde i reports on seeral system resource limits" (t'er parameters
can be c'eced on a runnin2 system usin2 adb :
3 adb /de/syms /de/mem parametername/D OD =to exit>
(t'er commands:
3 prtmem 3 memps m
$"" S'o@ memory in AIX: 9999999999999999999999999
MM S'o@ 5otal memory: 99999
3 bootino r 3 lsattr 4l sys- a realmem 3 prtcon =you can 2rep it on
memory>
MM S'o@ Details o memory:
8ou can 'ae a more detailed and compre'ensie loo at AIX memory by
usin2 <mstat < and <mo !< or <mo a<:
&or example:
. memory pools $G$- pinned pa2es -"- maxpin
percenta2e -"- minperm percenta2e -"- maxperm
percenta2e %" numperm percenta2e $%.. ile pa2es
-"- compressed percenta2e - compressed pa2es
%" numclient percenta2e -"- maxclient percenta2e
$%%.% client pa2es - remote pa2eouts sc'eduled $%%.
pendin2 dis I/(s bloced @it' no pbu C%C0- pa2in2 space I/(s
bloced @it' no psbu $CG$ ilesystem I/(s bloced @it' no sbu
- client ilesystem I/(s bloced @it' no sbu 0-G
external pa2er ilesystem I/(s bloced @it' no sbu -
#irtualiBed Partition 6emory Pa2e &aults -"-- 5ime
resolin2 irtualiBed partition memory pa2e aults
5'e mo command really 2ies lots o output" In t'e ollo@in2 example
only a small raction o t'e output is s'o@n:
3 mo !
maxpin $.0 $.0 S "" ""
MM 5o urt'er loo at your irtual memory and its causes, you can use
a combination o: 3 ipcs bm =s'ared memory> 3 lsps a
=pa2in2> 3 mo a or mo ! =irtual memory options> 3 smon ;
=basic memory allocations> 3 smon U =irtual memory usa2e by
user> 3 smon P 3 mstat
5o print out t'e memory usa2e statistics or t'e users root and stee
tain2 into account only @orin2 se2ments, type:
smon U root stee @
5o print out t'e top $- users o t'e pa2in2 space,
type:
smon U 2 t $-
5o print out t'e memory usa2e statistics or t'e user stee,
includin2 t'e list o t'e process identiiers, type:
smon U stee l smon U emcdm l
3 mo o nps@arn9alue 3 sc'edo o paceor9$%
Note: sysdumpde e Alt'ou2' t'e sysdumpde command is used to s'o@ or
alter t'e dumpdeice or a system dump, you can also use it to s'o@
'o@ muc' real memory is used"
5'e command 3 sysdumpde e proides an estimated dump siBe tain2 into
account t'e current memory =not pa2in2space> currently in use by
t'e system"
Note: t'e rmss command:
or system siBin2, as you can install more memory t'an is reFuired
and t'en use rmss to reduce it" Usin2 ot'er perormance tools, t'e
eects o t'e reduced memory can be monitored" 5'e rmss command 'as
t'e ability to run a command multiple times usin2 dierent simulated
memory siBes and produce statistics or all o t'ose memory
siBes"
5'e rmss command resides in /usr/bin and is part o t'e
bos"per"tools ileset, @'ic' is installable rom t'e AIX base
installation media"
Syntax rmss p c Q6)M r (ptions p Print t'e current alue c 6) 1'an2e
to 6 siBe =in 6bytes> r 7estore all memory to use p Print t'e
current alue
4xample: ind out 'o@ muc' memory you 'ae online rmss p 4xample:
1'an2e aailable memory to %C 6bytes rmss c %C 4xample: Undo t'e
aboe rmss r
arnin2:
rmss can dama2e perormance ery seriously Dont 2o belo@ % o t'e
mac'ines memory Neer or2et to inis' @it' rmss r
5'e pstat command:
5'e pstat command, @'ic' displays many system tables suc' as a
process table, inode table, or processor status table, 5'e pstat
command interprets t'e contents o t'e arious system tables and
@rites it to standard output"
Use t'e pstat command rom t'e AIX %" command prompt" See t'e
command reerence or details and examples, or use t'e syntax summary
in t'e table belo@"
u ProcSlot Displays t'e user structure o t'e process in t'e
desi2nated slot o t'e process table" An error messa2e is 2enerated
i you attempt to display a s@apped out process" 5 Displays t'e
system ariables" 5'ese ariables are briely described in ar"' U
5'readSlot Displays t'e user structure o t'e ernel t'read in t'e
desi2nated slot o t'e ernel t'read table" An error messa2e is
2enerated i you attempt to display a s@apped out ernel
t'read"
KKK Note $: Ho@ to 2et a <reaonable< ie@ on memory
consumption o a process in UNIX:
it' usin2 Rust t'e command line, or some ree utils"
In 2eneral not so easy to ans@er, because o t'e <sub
components< you mi2't distin2uis' in memory occupation" &or
example, do you mean 7SS, real, s'ared, irtual, pa2in2, includin2
all libraries loaded, etc""J
Some people lie to use t'e ps command @it' some special la2s, lie
ps 2 ps aux@ 3 or ps aux@ ? sort r G ?'ead $- =top
users>
)ut t'ose commands seems not so ery satisactory, and not
<complete< in t'eir output"
5'ere are some 2reat common utilities lie topas, nmon, top etc"",
or tools speciic to a certain Unix, lie S61 or Solaris" No
bad @ord on t'ose tools, because t'ey are 2reat" )ut some people
t'in t'at t'ey are not satisactory
on t'e subRect o memory consumption o a process =alt'ou2' t'ey s'o@
a lot o ot'er interestin2 inormation>"
Some ot'er @ays mi2't be:
3 procmap pid =in e"2" AIX> 3 pmap x pid =in e"2"
Solaris>
5'ose tools also s'o@ a <total< memory usa2e, @'ic' is a 2ood
indicator"
&or example: 3 pmap x TT
&&$---- C- C- rx libc"so"$ &&GA--- r@x libc"so"$
&&---- r@x libc"so"$ &&---- %.C %.C rx libnsl"so"$
&&G$---- - - r@x libnsl"so"$ &&G$A--- $C r@x
libnsl"so"$ &&G%---- $C $C rx libmp"so" &&GC--- r@x
libmp"so" &&G---- - - rx libsocet"so"$ &&G0A--- r@x
libsocet"so"$ &&GA---- rx libdl"so"$ &&G)---- r@x
anon V &&G1---- $% $% rx ld"so"$ &&G&C--- r@x
ld"so"$ &&)&1--- $C $C r@ stac V total b $%C $
5'is 2ies you a reasonable idea on memory consumption o a
pid"
8ou can also try:
3 smon ; 3 smon U 3 smon P t $- =top $- users> 3 smon U stee l
=memory stats or user stee>
)ut smon is not aailable on all unixes"
5'e ollo@in2 mi2't also be 'elpull =not on all unixes>:
3 ls l /proc/Wpid/as 3 prstat a s rss
And ps can 2ie some ino as @ell
3 ps e ? e2rep <S5I64?T!(;NA64< ? sort G r ? 'ead n $% 3 ps
au
$""G S'o@ memory in !inux: 999999999999999999999999999
3 /usr/sbin/dmes2 ? 2rep <P'ysical:< 3 cat /proc/memino 3 ree
m
5'e ipcs, mstat, iostat and t'at type o commands, are ocourse more
or less t'e same in !inux as t'ey are in Solaris or AIX"
$"" S'o@ aioserers in AIX:
99999999999999999999999999999
3 lsattr 4l aio- autoconi2 aailable S5A54 to be coni2ured at system
restart 5rue astpat' enable State o ast pat' 5rue procprio G0 Serer
P7I(7I58 5rue maxreFs -0C 6aximum number o 74+U4S5S 5rue maxserers
$- 6AXI6U6 number o serers per cpu 5rue minserers $ 6INI6U6 number
o serers 5rue
3 pstat a ? 2rep c aios -
3 ps ? 2rep aioserer GG$0C -:$% aioserer G%. -:$
aioserer %-C -:$ aioserer %0- -:$- aioserer
%C%0 -:$$ aioserer %C0G. -:$- aioserer %$CC- -:$$
aioserer %%.% -:$. aioserer %0%C -:$ aioserer
%0G0% -:$% aioserer %0-% -:$. aioserer C-$%- -:$
aioserer C-C -:$G aioserer .C -:$ aioserer 00$
-:$ aioserer 00%G -:$$ aioserer $--.C$C -:$ aioserer
$-$$.CC -:$G aioserer $--0C -:$G aioserer $-G$
-:$G aioserer
'at are aioserers in AIX%J:
it' I( on ilesystems, or example i a database is inoled, you may
try to tune t'e number o aioserers =async'ronous I(>
Use one o t'e ollo@in2 commands to set t'e number o serers" 5'is
applies only @'en usin2 async'ronous I/( on ile systems rat'er t'an
ra@ deices:
3 smit aio
3 c'de P l aio- a maxserers9$ a minserers9-
5o set async'ronous I( to YAailable: 3 c'de l aio- P a
autoconi29aailable
8ou need to restart t'e Serer: 3 s'utdo@n &r
$""% aio on !inux distros: 9999999999999999999999999999
(n some !inux distros, (racle 0i/$-2 supports async'ronous I/( but
it is disabled by deault because some !inux distributions do not
'ae libaio by deault" &or Solaris, t'e ollo@in2 coni2uration is
not reFuired sip do@n to t'e section on enablin2 async'ronous
I/("
(n !inux, t'e (racle binary needs to be relined to enable
async'ronous I/(" 5'e irst t'in2 to do is s'utdo@n t'e (racle
serer" Ater (racle 'as s'utdo@n, do t'e ollo@in2 steps to relin t'e
binary:
su oracle cd T(7A1!4EH(64/rdbms/lib mae insErdbms"m asyncEon mae
insErdbms"m ioracle
$""C 5'e ipcs and ipcrm commands:
9999999999999999999999999999999999
5'e <ipcs< command is really a <listin2< command" )ut i
you need to interene in memory structures, lie or example i you
need to <clear< or remoe a s'ared memory se2ment, because a
aulty or cras'ed application let semap'ores, memory identiiers, or
Fueues in place, you can use to <ipcrm< command to remoe
t'ose structures"
4xample ipcrm command usa2e:
3 ipcs bm ? 2rep )01
5'is mi2't 2ie you, or example, t'e s'ared memory identiier
<%-%%0..<" No@ clear t'e se2ment:
3 ipcrm m %-%%0..
It mi2't also be, t'at still a semap'ore and/or Fueue is still
<let oer<" In t'at case you mi2't also try commands lie t'e
ollo@in2 example:
ipcs F ipcs s
3 ipcrm s =remoe semap'ore> 3 ipcrm F %$$$G =remoe
Fueue>
Note: in some cases t'e <slibclean< command can be used to
clear unused modules in ernel and library memory" Zust 2ie as root
t'e command:
3 slibclean
(t'er 4xample:
I you run t'e ollo@in2 command to remoe a s'ared memory se2ment and
you 2et t'is error:
3 ipcrm m C%%G. ipcrm: -%$%-- s'mid=C%%G.> @as not ound"
Ho@eer, i you run t'e ipcs command, you still see t'e se2ment
t'ere:
3 ipcs ? 2rep C%%G. m C%%G. -x-------- D1r@ root system
I you loo careully, you @ill notice t'e <D< in t'e ort'
column" 5'e <D< means:
D I t'e associated s'ared memory se2ment 'as been remoed" It
disappears @'en t'e last process attac'ed to t'e se2ment detac'es
it"
So, to clear t'e s'ared memory se2ment, ind t'e process @'ic' is
still associated @it' t'e se2ment:
3 ps e ? 2rep processEo@ner
@'ere processEo@ner is t'e name o t'e o@ner usin2 t'e s'ared
se2ment
3 ill 0 pid
7unnin2 anot'er ipcs command @ill s'o@ t'e s'ared memory se2ment no
lon2er exists:
3 ipcs ? 2rep C%%G. 4xample
ipcrm m C%%G.
Solaris: 99999999
3s'o@re p 7eports @'ic' patc'es are installed
sysde and dmes2:
5'e oll@in2 commands also displays coni2uration inormation 3 sysde
3 dmes2
ersions:
99M 5o c'ec your Solaris ersion: 3 uname a or uname m 3 cat
/etc/release 3 isaino
99M 5o c'ec your AIX ersion:
3 osleel 3 osleel r tells you @'ic' maintenance leel you 'ae"
MM 5o ind t'e no@n recommended maintenance leels: 3 osleel rF
MM 5o list all no@n recommended maintenance and tec'nolo2y leels on
t'e system, type:
3 osleel F s no@n Serice Pacs %G---%- %G---%-G %G---%- %G---%-$
%G---%-- %G---1SP %G----G %G---- %G----$ %G---G1SP
MM 4xample: %G--- is 5! - %G---- is 5! - and SP - %G---1SP is 5! -
and 1SP or 5! - =and t'ere @ont be anymore SPs because @'en you see
a 1SP it is because t'e next 5! 'as been released" In t'is case it
@ould be 5! -G>"
MM Ho@ can I determine @'ic' ileset updates are missin2 rom a
particular AIX leelJ 5o determine @'ic' ileset updates are missin2
rom %G---, or example, run t'e ollo@in2 command:
3 osleel rl %G---
MM 'at SP =Serice Pac> is installed on my systemJ 5o see @'ic'
SP is currently installed on t'e system, run t'e osleel s command"
Sample output or an AIX %! #ersion %"G system, @it' 5!, and SP
installed @ould be:
3 osleel s %G----
MM Is a 1SP =1oncludin2 Serice Pac> installed on my
systemJ 5o see i a 1SP is currently installed on t'e system, run
t'e osleel s command" Sample output or an AIX %! #ersion %"G
system, @it' 5!G, and 1SP installed @ould be:
3 osleel s %G---G1SP
99M 5o c'ec your HP mac'ine:
3 model 0---/--/rp.$-
: mac'ine ino on AIX
Ho@ do I ind out t'e 1'ip type, System name, Node name, 6odel
Number etc"J
5'e uname command proides details about your system" uname p
Displays t'e c'ip type o t'e system" &or example,
po@erpc"
uname r Displays t'e release number o t'e operatin2 system" uname s
Displays t'e system name" &or example, AIX" uname n Displays
t'e name o t'e node" uname a Displays t'e system name,
nodename,#ersion, 6ac'ine id" uname 6 Displays t'e system model
name" &or example, I)6, .-C)%-" uname Displays t'e operatin2
system ersion uname m Displays t'e mac'ine ID number o t'e 'ard@are
runnin2 t'e system" uname u Displays t'e system ID number"
Arc'itecture:
5o see i you 'ae a 1H7P mac'ine, lo2 into t'e mac'ine as t'e root
user, and run t'e ollo@in2 command:
3 lsc2 ? 2rep Arc'itecture or use: 3 lsc2 pl sysplanar- ?
more
5'e bootino p command also s'o@s t'e arc'itecture o t'e pSeries,
7S/C---
3 bootino p c'rp
$"" 1'ec @'et'er you 'ae a G bit or C bit ersion:
99999999999999999999999999999999999999999999999999999999
Solaris:
3 iasino
I /usr/bin/isaino cannot be ound, t'en t'e (S only supports Gbit
process address spaces" =Solaris . @as t'e irst ersion t'at could
run Cbit binaries on certain SPA71based systems"> So a s'based
test mi2't loo somet'in2 lie
i x /usr/bin/isaino V[ t'en bits9Y/usr/bin/isaino bY else bits9G
i
AIX:
1ommand: /bin/lslpp l bos"Cbit """to see i bos"Cbit is installed K
committed"
or /bin/localeC """error messa2e i on Gbit mac'ine suc' as:
1ould not load pro2ram /bin/localeC:
1annot run a Cbit pro2ram on a Gbit mac'ine"
(r use:
3 bootino displays t'e current ernel @ordsiBe o <G< or
<C< 3 bootino y tells i 'ard@are is Cbit capable 3 bootino p
I it returns t'e strin2 G it is only capable o runnin2 t'e
Gbit ernel" I it returns t'e strin2 c'rp t'e mac'ine is
capable o runnin2 t'e Cbit ernel or t'e G bit ernel" (r use:
3 /usr/bin/2etcon HA7DA74E)I56(D4
C
Note:
H( 5( 1HAN;4 47N4! 6(D4 (& I)6 AIX %! =%"$>
5'e AIX %! 'as preconi2ured ernels" 5'ese are listed belo@
or
Po@er processors:
/usr/lib/boot/unixEC C bit multiprocessor ernel
S@itc'in2 bet@een ernel modes means usin2 dierent ernels"
5'is is simply done by pointin2 t'e location t'at is
reerenced by t'e system to t'ese ernels" Use symbolic lins
or t'is purpose" Durin2 boot AIX system runs t'e ernel in
t'e ollo@in2 locations:
/unix /usr/lib/boot/unix
5'e base operatin2 system Cbit runtime ileset is bos"Cbit"
Installin2 bos"Cbit also installs t'e /etc/met'ods/c2C ile" 5'e
/etc/met'ods/c2C ile proides t'e
option o enablin2 or disablin2 t'e Cbit enironment ia S6I5, @'ic'
updates t'e /etc/inittab ile
@it' t'e loadCbit line" =Simply addin2 t'e loadCbit line does not
enable t'e Cbit
enironment>"
5'e command lslpp l bos"Cbit reeals i t'is ileset is
installed" 5'e bos"Cbit ileset is on t'e AIX media[ 'o@eer,
installin2 t'e bos"Cbit ileset does
not ensure t'at you @ill be able to run Cbit sot@are" I t'e
bos"Cbit ileset is installed on G
bit 'ard@are, you s'ould be able to compile Cbit sot@are, but you
cannot run Cbit pro2rams on G
bit 'ard@are"
5'e syscallsC extension must be loaded in order to run a
Cbit executable" 5'is is done rom t'e loadCbit entry in t'e inittab
ile" 8ou must load t'e syscallsC
extension een @'en runnin2 a Cbit ernel on Cbit 'ard@are"
5o determine i t'e Cbit ernel extension is loaded, at t'e
command line, enter 2enex ?2rep C" Inormation similar to t'e
ollo@in2 displays: $0b% aGec /usr/lib/driers/syscallsC"ext
5o c'an2e t'e ernel mode ollo@ steps belo@:
$" 1reate symbolic lin rom /unix and /usr/lib/boot/unix to
t'e location
o t'e desired ernel" " 1reate boot ima2e" G" 7eboot
AIX"
)elo@ lists t'e detailed actions to c'an2e ernel mode:
5o c'an2e to G bit uniprocessor mode:
3 ln s /usr/lib/boot/unixEup /unix 3 ln s
/usr/lib/boot/unixEup /usr/lib/boot/unix 3 bosboot ad
/de/ipldeice 3 s'utdo@n r
5o c'an2e to G bit multiprocessor mode:
3 ln s /usr/lib/boot/unixEmp /unix 3 ln s
/usr/lib/boot/unixEmp /usr/lib/boot/unix 3 bosboot ad
/de/ipldeice 3 s'utdo@n r
5o c'an2e to C bit multiprocessor mode:
3 ln s /usr/lib/boot/unixEC /unix
3 ln s /usr/lib/boot/unixEC /usr/lib/boot/unix 3
bosboot ad /de/ipldeice 3 s'utdo@n r
I6P(75AN5 N(54: I you are c'an2in2 t'e ernel mode to Gbit
and you @ill run 0" on t'is serer, t'e ollo@in2 line s'ould be
included in
/etc/inittab:
loadCbit::@ait:/etc/met'ods/c2C M/de/console MK$ 3 4nable
Cbit execs
5'is allo@s Cbit applications to run on t'e Gbit ernel" Note
t'at t'is line is also mandatory i you are usin2 t'e Cbit
ernel"
In AIX %", t'e Gbit ernel is installed by deault" 5'e Cbit ernel,
alon2 @it' Z&S =en'anced Rournaled ile system>, can be
enabled at installation time"
1'ecin2 i ot'er unixes are in G or C mode:
Di2ital UNIX/5ruC: 5'is (S is only aailable in Cbit orm"
HPUX=Aailable in Cbit startin2 @it' HPUX $$"->: 1ommand:
/bin/2etcon 47N4!E)I5S """returns eit'er G or C
S;I: 5'is (S is only aailable in Cbit orm"
5'e remainin2 supported UNIX platorms are only aailable in Gbit
orm"
scinstall:
3 scinstall p Displays Sun 1luster sot@are release and paca2e
ersion inormation
$""0 Ino about 1PUs: 9999999999999999999999
Solaris:
3 psrino S'o@s t'e number o processors and t'eir status"
3 psrino ?2rep <Status o processor<?@c l S'o@s number o
cpus
!inux:
3 cat /proc/cpuino 3 cat /proc/cpuino ? 2rep processor?@c l
4specially @it' !inux, t'e /proc directory contains special
<iles< t'at eit'er extract inormation rom or send inormation
to t'e ernel
HPUX:
3 ioscan n1 processor 3 /usr/sbin/ioscan ? 2rep processor 3 2rep
processor /ar/adm/syslo2/syslo2"lo2 3 /usr/contrib/bin/mac'ino
=Itanium>
Seeral @ays as,
$" sam M perormance monitor M processor " printEmaniest =i i2niteux
installed> G" mac'ino =$$"G HP ersions> " ioscan n1 processor
%" ec'o <processorEcount/D< ? adb /stand/munix /de/mem C" top
command to 2et cpu count
5'e <2etcon< command can 2ie you a lot o interestin2 ino" 5'e
parameters are:
A7;E6AX E)1E)AS4E6AX )1EDI6E6AX )SES1A!4E6AX
)1ES57IN;E6AX 1HA71!ASSENA64E6AX 1HA7E)I5 1HA7E6AX 1HA7E6IN
1HI!DE6AX 1!E51 1(!!E4I;H5SE6AX 1PUE1HIPE58P4
1SE6A1HIN4EID4N5 1SEPA75I5I(NEID4N5 1SEPA5H
1SE6A1HIN4ES47IA! 4XP7EN4S5E6AX HE1PUESUPPE)I5S
HEGECE1APA)!4 IN5E6AX IN5E6IN 47N4!E)I5S !IN4E6AX
!(N;E)I5 !(N;E6AX !(N;E6IN 6A1HIN4EID4N5 6A1HIN4E6(D4!
6A1HIN4ES47IA! 6)E!4NE6AX N;7(UPSE6AX N!EA7;6AX
N!E!AN;6AX N!E6S;6AX N!EN6AX N!ES456AX N!E54X56AX N\47(
(P4NE6AX PA75I5I(NEID4N5 PA5H EP(SIXEA7;E6AX
EP(SIXEZ()E1(N57(! EP(SIXEN;7(UPSE6AX EP(SIXE(P4NE6AX
EP(SIXESA#4DEIDS EP(SIXESSI\4E6AX EP(SIXES574A6E6AX
EP(SIXE5\NA64E6AX EP(SIXE#47SI(N P(SIXEA7;E6AX
P(SIXE1HI!DE6AX P(SIXEZ()E1(N57(! P(SIXE!INE6AX
P(SIXE6AXE1AN(N P(SIXE6AXEINPU5
P(SIXENA64E6AX P(SIXEN;7(UPSE6AX P(SIXE(P4NE6AX
P(SIXEPA5HE6AX P(SIXEPIP4E)U& P(SIXESA#4DEIDS
P(SIXESSI\4E6AX P(SIXES574A6E6AX P(SIXE5\NA64E6AX
P(SIXE#47SI(N P(SIXE)1E)AS4E6AX P(SIXE)1EDI6E6AX
P(SIXE)1ES1A!4E6AX P(SIXE)1ES57IN;E6AX P(SIXE1E)IND
P(SIXE1ED4# P(SIXE1E#47SI(N P(SIXE1HA7E5476 P(SIXE1HI!DE6AX
P(SIXE1(!!E4I;H5SE6AX P(SIXE4XP7EN4S5E6AX P(SIXE&(75ED4#
P(SIXE&(75E7UN P(SIXE!IN4E6AX P(SIXE!(1A!4D4&
P(SIXE74EDUPE6AX P(SIXESED4# P(SIXEUP4 P(SIXE#47SI(N
S1EPASSE6AX S1EX(P4NE#47SI(N S1HA7E6AX S1HA7E6IN
SH75E6AX SH75E6IN SSI\4E6AX
4xample:
2etEcpuEersion=> W
case Y2etcon 1PUE#47SI(NY in 3 JJJ> ec'o
<Itanium56V < [[ .C> ec'o <Itanium56V $< [[
%G> ec'o <PA7IS1 "-< [[ %0> ec'o
<PA7IS1 $"< [[ %> ec'o <PA7IS1 $"$< [[
%G> ec'o <PA7IS1 $"-< [[ *> return $ [[
esac return -
AIX:
3 pmcycles m 1pu - runs at $C%C 6HB 1pu $ runs at $C%C 6HB 1pu runs
at $C%C 6HB 1pu G runs at $C%C 6HB
3 lsc2 ? 2rep proc
6ore cpu inormation on AIX:
3 lsattr 4l procx =@'ere x is t'e number o t'e cpu> type
po@erP1EP(47% Processor type &alse reFuency $C%C----- Processor
speed &alse "" "" @'ere &alse means t'at t'e alue cannot be
c'an2ed t'rou2' an AIX command"
3 lparstat =only or latest AIX ersions> 3 lparstat i
5o ie@ 1PU sc'eduler tunable parameters, use t'e sc'edo
command:
3 sc'edo a
In AIX %! on Po@er%, you can s@itc' rom Simultaneous 6ultit'readin2
S65, or Sin2le 5'readin2 S5, as ollo@s =smtcl> 3 smtctl m o @ill
set S65 mode to disabled 3 smtctl m on @ill set S65 mode to enabled
3 smtctl boot maes S65 eectie on next boot 3 smtctl no@ eects S65
no@, but @ill not persist across reboots
'en you @ant to eep t'e settin2 across reboots, you must use t'e
bosboot command in order to create a ne@ boot ima2e"
$""$- (t'er stu: 9999999999999999999
runleel: 5o s'o@ t'e init runleel: 3 @'o r
5op users:
5o 2et a Fuic impression about t'e top $- users in t'e system at
t'is time:
ps aux@ ? sort r G ?'ead $- S'o@s top $- memory usa2e by process ps
aux@ ? sort r ?'ead $- S'o@s top $- 1PU usa2e by process
6ore accuracy in memory usa2e @it' t'e ps command: ps 2
ps 2:
in dierent units, but t'ese numbers do not tell t'e @'ole story on
@'ere all t'e memory 2oes"
&irst o all, t'e man pa2e or ps does not 2ie an accurate
description o t'e memory related ields" Here is a better
description:
7SS 5'is tells 'o@ muc' 7A6 resident memory is currently bein2 used
or t'e text and data se2ments or a particular process in units o
ilobytes" =t'is alue @ill al@ays be a multiple o since memory is
allocated in ) pa2es>"
646 5'is is t'e raction o 7SS diided by t'e total siBe o 7A6 or a
particular process" Since 7SS is some subset o t'e total resident
memory usa2e or a process, t'e 646 alue @ill also be lo@er t'an
actual"
57S 5'is tells 'o@ muc' 7A6 resident memory is currently bein2 used
or t'e text se2ment or a particular process in units o ilobytes"
5'is @ill al@ays be less t'an or eFual to 7SS"
SI\4 5'is tells 'o@ muc' pa2in2 space is allocated or t'is process
or t'e text and data se2ments in units o ilobytes" I t'e executable
ile is on a local ilesystem, t'e pa2e space usa2e or text is Bero"
I t'e executable is on an N&S ilesystem, t'e pa2e space usa2e
@ill be nonBero" 5'is number may be 2reater t'an 7SS, or it may
not, dependin2 on 'o@ muc' o t'e process is pa2ed in" 5'e reason
7SS can be lar2er is t'at 7SS counts text @'ereas SI\4 does
not"
5SI\ 5'is ield is absolutely bo2us because it is not a multiple o
and does not correlate to any o t'e ot'er ields"
5'ese ields only report on a process text and data se2ments"
Se2ment siBe @'ic' cannot be interro2ated at t'is time are:
5ext portion o s'ared libraries =se2ment $G> &iles t'at are
in use" (pen iles are cac'ed in memory as indiidual se2ments"
S'ared data se2ments created @it' s'mat" ernel se2ments suc' as
ernel se2ment -, ernel extension se2ments, and irtual memory
mana2ement se2ments"
In summary, ps is not a ery 2ood tool to measure system memory
usa2e" It can 2ie you some idea @'ere some o t'e memory 2oes, but
it leaes too many Fuestions unans@ered about t'e total usa2e"
s'ared memory:
5o c'ec s'ared memory se2ment, semap'ore array, and messa2e Fueue
limits, issue t'e ipcs l command" 3 ipcs
5'e ollo@in2 tools are aailable or monitorin2 t'e perormance o your
UNIXbased system"
piles: /usr/proc/bin/piles 5'is s'o@s t'e open iles or t'is
process, @'ic' 'elps you dia2nose @'et'er you are 'ain2 problems
caused by iles not 2ettin2 closed"
lso:
5'is utility lists open iles or runnin2 UNIX processes, lie piles"
Ho@eer, lso 2ies more useul inormation t'an piles" 8ou can ind lso
at tp://ic"cc"purdue"edu/pub/tools/unix/lso/"
4xample o lso usa2e:
8ou can see 1I( =concurrent I(> in t'e &I!4&!A; column i
you run lso 2, e"2": tarunx-$:/'ome/abiele@i:3
/p%.-build/!S(&/lso".C/usr/local/bin/lso 2
/baanprd/oradat
1(66AND PID US47 &D 58P4 &I!4&!A; D4#I14
SI\4/(&& N(D4 NA64 oracle G oracle $Cu #74;
7,,1I(,DS8N,!;[1X G0,$ C.-$-%C CC /baanprd/oradat
=/de/bprdoradat> oracle G oracle $.u #74; 7,,1I(,DS8N,!;[1X G0,$
C.-$-%C C. /baanprd/oradat =/de/bprdoradat> oracle G oracle $%u
#74; 7,,1I(,DS8N,!;[1X G0,$ $$.$GG$ .% /baanprd/oradat
=/de/bprdoradat> oracle G oracle $Cu #74; 7,,1I(,DS8N,!;[1X G0,$
.G-$$G0 .. /baanprd/oradat =/de/bprdoradat> oracle %-$ oracle
$%u #74; 7,,1I(,DS8N,!;[1X G0,$ $$.$GG$ .% /baanprd/oradat
=/de/bprdoradat> oracle %-$ oracle $Cu #74; 7,,1I(,DS8N,!;[1X
G0,$ $$-C. .C /baanprd/oradat =/de/bprdoradat> oracle .CCC
oracle $%u #74; 7,,1I(,DS8N,!;[1X G0,$ $$.$GG$ .% /baanprd/oradat
=/de/bprdoradat 8ou s'ould also see (E1I( in your ile open
calls i you run truss, e"2":
open=</opt/oracle/rcat/oradat/redo-$"lo2<,
(E7D7?(E1I(?(EDS8N1?(E!A7;4&I!4> 9 $
#6S5A5 S(!A7IS:
3 mstat 5'is command is ideal or monitorin2 pa2in2 rate, @'ic' can
be ound under t'e pa2e in =pi> and pa2e out =po> columns"
(t'er important columns are t'e amount o allocated irtual stora2e
=am> and ree irtual stora2e =re>" 5'is command is useul or
determinin2 i somet'in2 is suspended or Rust tain2 a lon2
time"
4xample:
t'r memory pa2e dis aults cpu r b @ s@ap ree re m pi po
r de sr m- m$ mG m in sy cs us sy id - - - $CG$% $.$C.- $%.
$$ $$.0 $ $ - - - - - - C- $.G. %% $- G . - - - $$0-- $.0G% -
$ - - - - - - - $ - G% C% GC $ $ 0 - - - $$0C- $.0G - $C. - -
- - - - - - - - $.$- $ 0 - - - $$00 $.GC - $C$ - - - - - - -
- - $-C %%G $ $- % % - - - $$- $.G% - - - - - - - - - - %-%
$$.. % 0 - - - $$C $.C% - - - - - - - - - - $. -$% $%G- C 0-
- - - $$.. $..0C- G- - - - - - - - - .G $$ C- 0.
procs/r: 7un Fueue len2t'" procs/b: Processes bloced @'ile @aitin2
or I/(" procs/@: Idle processes @'ic' 'ae been s@apped"
memory/s@ap: &ree, unresered s@ap space =b>" memory/ree:
&ree memory =b>" =Note t'at t'is @ill 2ro@ until it reac'es
lotsree, at @'ic' point
t'e pa2e scanner is started" See <Pa2in2< or more
details"> pa2e/re: Pa2es reclaimed rom t'e ree list" =I a pa2e
on t'e ree list still contains data needed
or a ne@ reFuest, it can be remapped"> pa2e/m: 6inor aults =pa2e
in memory, but not mapped>" =I t'e pa2e is still in memory, a
minor ault
remaps t'e pa2e" It is comparable to t'e lts alue reported by sar
p"> pa2e/pi: Pa2ed in rom s@ap =b/s>" ='en a pa2e is brou2't
bac rom t'e s@ap deice, t'e process
@ill stop execution and @ait" 5'is may aect perormance">
pa2e/po: Pa2ed out to s@ap =b/s>" =5'e pa2e 'as been @ritten and
reed" 5'is can be t'e result o
pa2e/sr: Scan rate =pa2es>" Note t'at t'is number is not
reported as a <rate,< but as a total number o pa2es scanned"
dis/s3: Dis actiity or dis 3 =I/(s per second>" aults/in:
Interrupts =per second>" aults/sy: System calls =per second>"
aults/cs: 1ontext s@itc'es =per second>" cpu/us: User 1PU time
=>" cpu/sy: ernel 1PU time =>" cpu/id: Idle I/( @ait 1PU time
=>"
'en analyBin2 mstat output, t'ere are seeral metrics to @'ic' you
s'ould pay attention" &or example, eep an eye on t'e 1PU run
Fueue column" 5'e run Fueue s'ould neer exceed t'e number o 1PUs on
t'e serer" I you do notice t'e run Fueue exceedin2 t'e amount o
1PUs, its a 2ood indication t'at your serer 'as a 1PU bottlenec" 5o
2et an idea o t'e 7A6 usa2e on your serer, @atc' t'e pa2e in
=pi> and pa2e out =po> columns o mstats output" )y tracin2
common irtual memory operations suc' as pa2e outs, you can iner t'e
times t'at t'e (racle database is perormin2 a lot o @or" 4en t'ou2'
UNIX pa2e ins must correlate @it' t'e mstats reres' rate to
accurately predict 7A6 s@appin2, plottin2 pa2e ins can tell you
@'en t'e serer is 'ain2 spies o 7A6 usa2e"
(nce captured, its ery easy to tae t'e inormation about serer
perormance directly rom t'e (racle tables and plot t'em in a trend
2rap'" 7at'er t'an usin2 an expensie statistical paca2e suc' as
SAS, you can use 6icrosot 4xcel" 1opy and paste t'e data rom t'e
tables into 4xcel" Ater t'at, you can use t'e 1'art iBard to create
a line c'art t'at @ill 'elp you ie@ serer usa2e inormation and
discoer trends"
3 #6S5A5 AIX:
5'is is irtually eFual to t'e usa2e o mstat under solaris"
mstat can be used to 2ie multiple statistics on t'e system" &or
1PU speciic @or, try t'e ollo@in2 command:
3 mstat t $ G
5'is @ill tae G samples, $ second apart, @it' timestamps =t>"
8ou can, o course, c'an2e t'e parameters as you lie" 5'e output is
s'o@n belo@"
t'r memory pa2e aults cpu time
r b am re re pi po r sr cy in sy cs us sy id @a 'r mi se
- - %G $ - - - - $ - GC GC . C0 - $%:$-: - - %G - - -
- - - - $%0 G %G $ $ 0 - $%:$-:G - %G - - - - - - - $% $$% C
- 0 0- $ $%:$-:
In t'is output some o t'e t'in2s to @atc' or are:
<am<, @'ic' is Actie #irtual 6emory" Ideally, under normal
conditions, t'e lar2est am alue s'ould in 2eneral be smaller t'an
t'e amount o 7A6" I am is smaller t'an 7A6, and still exessie
pa2in2 occurs, t'at could be due to 7A6 bein2 illed @it' ile
pa2es"
am x 9 number o bytes
1olumns r =run Fueue> and b =bloced> start 2oin2 up,
especially aboe $-" 5'is usually is an indication t'at you 'ae too
many processes competin2 or 1PU"
I cs =contact s@itc'es> 2o ery 'i2' compared to t'e number o
processes, t'en you may need to tune t'e system @it' mtune"
In t'e cpu section, us =user time> indicates t'e time is bein2
spent in pro2rams" Assumin2 Zaa is at t'e top o t'e list in tpro,
t'en you need to tune t'e Zaa application>"
In t'e cpu section, i sys =system time> is 'i2'er t'an expected,
and you still 'ae id =idle> time let, t'is may indicate loc
contention" 1'ec t'e tpro or loc related calls in t'e ernel time"
8ou may @ant to try multiple instances o t'e Z#6" It may also be
possible to ind deadlocs in a Raacore ile"
In t'e cpu section, i @a =I/( @ait> is 'i2', t'is may indicate a
dis bottlenec, and you s'ould use iostat and ot'er tools to loo at
t'e dis usa2e"
#alues in t'e pi, po =pa2e in/out> columns are nonBero may
indicate t'at you are pa2in2 and need more memory" It may be
possible t'at you 'ae t'e stac siBe set too 'i2' or some o your Z#6
instances" It could also mean t'at you 'ae allocated a 'eap lar2er
t'an t'e amount o memory on t'e system" ( course, you may also 'ae
ot'er applications usin2 memory, or t'at ile pa2es may be tain2 up
too muc' o t'e memory
(t'er example:
System coni2uration: lcpu9 mem9G0-6)
t'r memory pa2e aults cpu r b am re re pi po r sr cy in sy cs us sy
id @a - - 0GC. GG.% - - - - - - G $0 C0 - - 00 - - - 0GC. GG.% - -
- - - - G GG CC - - 00 - - - 0GC. GG.% - - - - - - GG C - - 00 - -
- 0GC. GG.% - - - - - - - G-C $-- - $ 0. $ - - 0GC. GG.% - - - - -
- $ - C - - 00 - - - 0GC. GG.% - - - - - - GC C - - 00 - - - 0GC.
GG.% - - - - - - GG CC - - 00 - - - 0GC. GG.% - - - - - - $ CC - -
00 - - - 0GC. GG.% - - - - - - $ G. C - - 00 - - - 0GC. GG.% - - -
- - - $0 CC - - 00 - - - 0GC. GG.% - - - - - - C G. .C - - 00 -
5'e most important ields to loo at 'ere are:
r 5'e aera2e number o runnable ernel t'reads oer @'ateer samplin2
interal you 'ae c'osen" b 5'e aera2e number o ernel t'reads t'at
are in t'e irtual memory @aitin2 Fueue oer your samplin2 interal" r
s'ould al@ays be 'i2'er t'an b[ i it is not, it usually means you
'ae a 1PU bottlenec" re 5'e siBe o your memory ree list" Do not
@orry so muc' i t'e amount is really small" 6ore importantly,
determine i t'ere is any pa2in2 2oin2 on i t'is amount is small" pi
Pa2es pa2ed in rom pa2in2 space" po Pa2es pa2ed out to pa2in2
space" 1PU section: us sy id @a
!ets loo at t'e last section, @'ic' also comes up in most ot'er 1PU
monitorin2 tools, albeit @it' dierent 'eadin2s:
us user time sy system time id idle time @a @aitin2 on I/(
amount o time reFuired or certain S+! operations =i t'ey are t'e
only actiity on t'e system>" 5'is command is also useul or
determinin2 i somet'in2 is suspended or Rust tain2 a lon2
time"
)asic synctax is iostat QoptionsM interal count
option let you speciy t'e deice or @'ic' inormation is needed lie
dis ,
cpu or terminal" =d , c , t or tdc > " x options 2ies t'e
extended statistics "
interal is time period in seconds bet@een t@o samples " iostat @ill
2ie data at eac' seconds interal"
count is t'e number o times t'e data is needed " iostat % @ill 2ie
data at seconds interal % times"
4xample:
T iostat xtc % extended dis statistics tty cpu dis
r/s @/s r/s @/s @ait act scEt @ b tin tout us sy @t id sd-
"C G"- -". ". -"$ -" %0" C $0 - G % $$ - sd$ " $"- GG"% "-
-"- -" ." G sd -"- -"- -"- -"- -"- -"- -"- - - sdG
$-" $"C %$" $" -"$ -"G G$" G G$ dis name o t'e dis r/s reads
per second @/s @rites per second r/s ilobytes read per second @/s
ilobytes @ritten per second @ait aera2e number o transactions
@aitin2 or serice =+ len2t'> act aera2e number o transactions
actiely
bein2 sericed =remoed rom t'e Fueue but not yet completed> @
percent o time t'ere are transactions @aitin2 or serice =Fueue
nonempty> b percent o time t'e dis is busy =transactions in
pro2ress>
5'e alues to loo rom t'e iostat output are:
7eads/@rites per second =r/s , @/s> Percenta2e busy =b>
Serice time =scEt> I a dis s'o@s consistently 'i2' reads/@rites
alon2 @it' , t'e percenta2e busy =b> o t'e diss is 2reater t'an
% percent, and t'e aera2e serice time =scEt> is 2reater t'an G-
milliseconds, t'en action needs to be taen"
4xample:
5o ind out all listenin2 serices, you can use t'e command
3 netstat a inet
3 top &or example:
load aera2es: -"CC, -"%, -"%C $$:$: $. processes: $% sleepin2, on
cpu 1PU states: idle, user, ernel, io@ait, s@ap 6emory: -0C6 real,
$06 ree, $0-6 s@ap in use, -G6 s@ap ree
PID US47NA64 5H7 P7I NI14 SI\4 74S S5A54 5I64 1PU 1(66AND
.0% oraclo@n $ %0 - C%6 C6 sleep -:$G "G oracle 0 root
$$ %0 - C$C .C. sleep $-:% G"0 bpbar $G0-. oraclo@n $$ %0 - .$6 $6
cpu :- "G oracle $$G oraclo@n $ %0 - .-6 G-6 sleep 0:-G $".C oracle
.0. oraclo@n $ %0 - $06 $%$6 sleep -:-$ -"0C oracle ..
oraclo@n $$ %0 - $0$6 $%G6 sleep -:-C -"C0 oracle .00
oraclo@n $ %0 - $0-6 $%$6 sleep -:- -"% oracle .G oraclo@n $$
%0 - $0$6 $%%6 sleep -:% -"G% oracle -$$ oraclo@n $$ %0 -
$0$6 $06 sleep :%- -". oracle --. oraclo@n $$ %0 - $0$6 $06
sleep : -"C oracle --0 oraclo@n $$ %0 - $0$6 $06 sleep $:%
-"- oracle - oraclo@n $ %$ - $.C- $0C cpu -:-- -"$0 top
-$G oraclo@n $$ %0 - $0$6 $6 sleep -:GC -"$ oracle -G%
oraclo@n $$ %0 - $0$6 $06 sleep : -"$G oracle $$ root $- %0
- %-$C $.C sleep G:G -"-% picld
Process ID 5'is column s'o@s t'e process ID =pid> o eac'
process" 5'e process ID is a positie number, usually less t'an
C%%GC" It is used or identiication durin2 t'e lie o t'e process"
(nce a process 'as exited or been illed, t'e process ID can be
reused"
Username 5'is column s'o@s t'e name o t'e user @'o o@ns t'e
process" 5'e ernel stores t'is inormation as a uid, and top uses an
appropriate table =/etc/pass@d, NIS, or NIS> to translate t'is
uid in to a name"
&or Solaris, t'is number is actually t'e number o li2't@ei2't
processes =l@ps> created by t'e t'reads paca2e to 'andle t'e
t'reads" Dependin2 on current resource utiliBation, t'ere may not
be one l@p or eery t'read" 5'us t'is number is actually less t'an
or eFual to t'e total number o t'reads created by t'e
process"
Nice 5'is column relects t'e <nice< settin2 o eac' process" A
processs nice is in'ereted rom its parent" 6ost user processes run
at a nice o -, indicatin2 normal priority" Users 'ae t'e option o
startin2 a process @it' a positie nice alue to allo@ t'e system to
reduce t'e priority 2ien to t'at process" 5'is is normally done or
lon2runnin2 cpubound Robs to eep t'em rom intererin2 @it'
interactie processes" 5'e Unix command <nice< controls
settin2 t'is alue" (nly root can set a nice alue lo@er t'an t'e
current alue" Nice alues can be ne2atie" (n most systems t'ey ran2e
rom - to -" 5'e nice alue inluences t'e priority alue calculated by
t'e Unix sc'eduler"
SiBe 5'is column s'o@s t'e total amount o memory allocated by eac'
process" 5'is is irtual memory and is t'e sum total o t'e processs
text area =pro2ram space>, data area, and dynamically allocated
area =or <brea<>" 'en a process allocates additional
memory @it' t'e system call <br<, t'is alue @ill increase"
5'is is done indirectly by t'e 1 library unction <malloc<"
5'e number in t'is column does not relect t'e amount o p'ysical
memory currently in use by t'e process"
7esident 6emory 5'is column relects t'e amount o p'ysical memory
currently allocated to eac' process" 5'is is also no@n as t'e
<resident set siBe< or 7SS" A process can 'ae a lar2e amount
o irtual memory allocated =as indicated by t'e SI\4 column> but
still be usin2 ery little p'ysical memory"
1PU 5ime 5'is column displayes t'e accumulated 1PU time or eac'
process" 5'is is t'e amount o time t'at any cpu in t'e system 'as
spent actually runnin2 t'is process" 5'e standard ormat s'o@s t@o
di2its indicatin2 minutes, a colon, t'en t@o di2its indicatin2
seconds" &or example, t'e display <$%:G< indicates iteen
minutes and t'irty t@o seconds" 'en a time alue is 2reater t'an or
eFual to $--- minutes, it is displayed as 'ours @it' t'e suix H"
&or example, t'e display <$."H< indicates $. 'ours plus
our tent's o an 'our = minutes>" 'en t'e number o 'ours exceeds
000"0, t'e <H< suix is dropped so t'at t'e display continues
to it in t'e column"
1PU Percenta2e 5'is column s'o@s t'e percenta2e o t'e cpu t'at eac'
process is currently consumin2" )y deault, top @ill sort t'is
column o t'e output" Some ersions o Unix @ill trac cpu percenta2es
in t'e ernel, as t'e i2ure is used in t'e calculation o a processs
priority" (n t'ose ersions, top @ill use t'e i2ure as calculated by
t'e ernel" (t'er ersions o Unix do not perorm t'is calculation, and
top must determine t'e percenta2e explicity by monitorin2 t'e
c'an2es in cpu time" (n most multiprocessor mac'ines, t'e number
displayed in t'is column is a percenta2e o t'e total aailable cpu
capacity" 5'ereore, a sin2le t'readed process runnin2 on a our
processor system @ill neer use more t'an % o t'e aailable cpu
cycles"
1ommand 5'is column displays t'e name o t'e executable ima2e t'at
eac' process is runnin2" In most cases t'is is t'e base name o t'e
ile t'at @as inoed @it' t'e most recent ernel <exec< call" (n
most systems, t'is name is maintained separately rom t'e Berot'
ar2ument" A pro2ram t'at c'an2es its Berot' ar2ument @ill not aect
t'e output o t'is column"
3 modino 5'e modino command proides inormation about t'e modules
currently loaded by t'e ernel"
t'ey aect D) perormance on a Solaris (peratin2 4nironment mac'ine"
See t'e +uic )e2innin2s inormation or urt'er details"
3 more /etc/pat'EtoEinst 5o see t'e mappin2 bet@een t'e ernel
abbreiated instance name or p'ysical deice names, ie@ t'e
/etc/pat'EtoEinst ile"
3 uptime uptime s'o@ 'o@ lon2 t'e system 'as been up
/export/'ome/oraclo@nMuptime $$:Gam up :$0, $ user, load
aera2e: -"-, $"$., -"0-
$""$ proc toos or Solaris: 99999999999999999999999999999
5'e proc tools are called t'at @ay, because t'e retreie inormation
romn t'e /proc irtual ilesystem 5'ey are:
/usr/proc/bin/pla2s rV pid""" /usr/proc/bin/pcred pid"""
/usr/proc/bin/pmap rxl&V pid""" /usr/proc/bin/pldd &V
pid""" /usr/proc/bin/psi2 pid""" /usr/proc/bin/pstac &V pid"""
/usr/proc/bin/piles &V pid""" /usr/proc/bin/p@dx &V pid"""
/usr/proc/bin/pstop pid""" /usr/proc/bin/prun pid"""
/usr/proc/bin/p@ait V pid""" /usr/proc/bin/ptree aV pid? userV"""V
/usr/proc/bin/ptime command ar2"""V /usr/proc/bin/pattr x V pid"""V
/usr/proc/bin/pclear pid"""V /usr/proc/bin/plabel pid"""V
/usr/proc/bin/ppri aV pid"""V
piles: reports all t'e iles @'ic' are opened by a 2ien pid
pldd lists all t'e dynamic libraries lined to t'e process
p@dx 2ies t'e directory rom @'ic' t'e process is runnin2
ot'er@ise it is assumed to be a user lo2in name" 5'e deault is all
processes"
Use it lie
3 ptree QPIDM
(r use it @it' params, @'ic' enables you to produce dierent
listin2s
5'e ollo@in2 example prints t'e process tree =includin2 c'ildren o
process -> or processes @'ic' matc' t'e command name ss':
T ptree a Yp2rep ss'Y $ /sbin/init $--0-0
/usr/lib/ss'/ss'd %C0$%- /usr/lib/ss'/ss'd %C0$%.
/usr/lib/ss'/ss'd %C0$%0 s' %C0$.$ bas' %C0$.G
/bin/s' %C0$0G bas'
7emar: many !inux distros adopted t'e ptree command, as t'e
<pstree< command" As in
Suppose you did a piles on an Apac'e process:
3 piles $G.0
$G.0: /apps$$i/erpde/$-;AS/Apac'e/Apac'e/bin/'ttpd d
/apps$$i/erpde/$-; 1urrent rlimit: $- ile descriptors -:
SEI&I&( mode:---- de:G%-,- ino:$$.G uid:C%-C- 2id:%-G
siBe:G-$ (E7D7 $: SEI&74; mode:-C- de:G-.,--$ ino:C$- uid:C%-C-
2id:%-G siBe:GC (E7(N!8?(EAPP4ND?(E174A5
/apps$$i/erpde/$-;AS/opmn/lo2s/H55PESerer^$ : SEI&I&(
mode:---- de:G%-,- ino:$G0%C uid:C%-C- 2id:%-G siBe:- (E7D7 G:
SEI&74; mode:-C-- de:G-.,--$ ino:C-CG. uid:C%-C- 2id:%-G
siBe:$-%C.C (E7D7?(E174A5
/apps$$i/erpde/$-;AS/Apac'e/Apac'e/lo2s/mm"$0G0"mem : SEI&74;
mode:-C-- de:G-.,--$ ino:C-CGG uid:C%-C- 2id:%-G siBe:-
(E7D7?(E174A5 %: SEI&74; mode:-C-- de:G-.,--$ ino:C$. uid:C%-C-
2id:%-G siBe:$-%C.C (E7D7?(E174A5 C: SEI&D((7 mode:- de:G%$,-
ino:% uid:- 2id:- siBe:- (E7D(N!8?(E!A7;4&I!4 &DE1!(4X41
door to nscd$V /ar/run/nameEsericeEdoor .: SEI&I&(
mode:---- de:G%-,- ino:$G0%C uid:C%-C- 2id:%-G siBe:- (E7D7 :
SEI&1H7 mode:-CCC de:G,- ino:.$%0 uid:- 2id:G rde:0-,- (E7D(N!8
/deices/pseudo/stat_-:stat etc"" "" "" (E7D7?(E174A5
/apps$$i/erpde/$-;AS/Apac'e/Apac'e/lo2s/dmsEmetrics"$0G0"s'm"sem $:
SEI&74; mode:-C-- de:G-.,--$ ino:C-G% uid:C%-C- 2id:%-G
siBe:$.- (E7D(N!8 &DE1!(4X41
/apps$$i/erpde/$-;AS/rdbms/mes2/ocius"msb G: SEI&S(1 mode:-CCC
de:G,- ino:C-GG0 uid:- 2id:- siBe:- (E7D7 S(1ES574A6
S(ESND)U&=0$%>,S(E71#)U&=0$%>,IPEN4X5H(P=-"-"$0"->
socname: A&EIN45 G"%C"$0" port: %G0% peername: A&EIN45
G"%C"$0" port: $%-$ %C: SEI&74; mode:- de:%,- ino:G%- uid:-
2id:G siBe:$C$C (E7D(N!8?(E!A7;4&I!4 /etc/inet/'osts
Suppose you tried pldd on t'e same process 2ae t'is result:
3 pldd $G.0
/usr/lib/libsc'ed"so"$ /apps$$i/erpde/$-;AS/libG/libclnts'"so"$-"$
/apps$$i/erpde/$-;AS/libG/libnnB$-"so
/apps$$i/erpde/$-;AS/Apac'e/Apac'e/libexec/modE@c'ands'ae"so
/apps$$i/erpde/$-;AS/Apac'e/Apac'e/libexec/modEocR"so
/apps$$i/erpde/$-;AS/Apac'e/Apac'e/libexec/modEdms"so
/apps$$i/erpde/$-;AS/Apac'e/Apac'e/libexec/modEre@rite"so
/apps$$i/erpde/$-;AS/Apac'e/orada/lib/modEorada"so
/apps$$i/erpde/$-;AS/Apac'e/modplsFl/bin/modplsFl"so
3 pmap x TT
$""$G ellno@n tools or AIX: 9999999999999999999999999999999
$" commands:
1PU 6emory Subsystem I/( Subsystem Net@or Subsystem mstat mstat
iostat netstat iostat lsps mstat iconi2 ps smon lsps tcpdump sar
ilemon ilemon tpro ipcs lmstat
nmon and topas can be used to monitor t'ose subsystems in
2eneral"
" topas:
topas is a useul 2rap'ical interace t'at @ill 2ie you immediate
results o @'at is 2oin2 on in t'e system" 'en you run it @it'out
any commandline ar2uments, t'e screen loos lie t'is:
'dis- -"- -"- -"- -"- -"- P2spIn - Noncomp .G"0 P2sp(ut -
1lient -"% Name PID 1PU P2Sp (@ner Pa2eIn - Raa $CC G"C G%"$ root
Pa2e(ut - PA;IN; SPA14 Raa $$0 $". C" root Sios - SiBe,6) %$ lrud
$-G ". -"- root Used $" aixterm $0%- -"% -". root N&S
=calls/sec> &ree 0". topas C0- -"% -" root Serer# - s' $$
-"- -". root 1lient# - Press: 2il $-C -"- -"- root Serer#G -
<'< or 'elp
5'e inormation on t'e bottom let side s'o@s t'e most actie
processes[ 'ere, Raa is consumin2 G"C o 1PU" 5'e middle ri2't area
s'o@s t'e total p'ysical memory =$ ;) in t'is case> and Pa2in2
space =%$ 6)>, as @ell as t'e amount bein2 used" So you 2et an
excellent oerie@ o @'at t'e system is doin2 in a sin2le screen, and
t'en you can select t'e areas to concentrate based on t'e
inormation bein2 s'o@n 'ere"
Note: about @aits:
Dont 2et cau2't up in t'is @'ole @ait i/o t'in2" a sin2le cpu
system @it' $ i/o outstandin2 and no ot'er runable t'reads =i"e"
idle> @ill 'ae $-- @ait i/o" 5'ere @as a bi2 discussion a couple
o years a2o on remoin2 t'e ernel tic as it 'as conused many many
many tec's"
So, i you 'ae only $ or e@ cpu, t'en you are 2oin2 to 'ae 'i2' @ait
i"o i2ures, it does not neccessarily mean your dis subsystem is
slo@"
G" trace:
=in AIX %>" 5'ese proide statistics on 1PU utiliBation and
process/t'read actiity" 5'e t'ird post processin2 tool is splat
@'ic' stands or Simple Perormance !oc Analysis 5ool" 5'is tool is
used to analyBe loc actiity in t'e AIX ernel and ernel extension or
simple locs"
" nmon:
nmon is a ree sot@are tool t'at 2ies muc' o t'e same inormation as
topas, but saes t'e inormation to a ile in !otus $G and 4xcel
ormat" 5'e do@nload site is
'ttp://@@@"ibm"com/deeloper@ors/eserer/articles/analyBeEaix/" 5'e
inormation t'at is collected included 1PU, dis, net@or, adapter
statistics, ernel counters, memory and t'e <top< process
inormation"
%" tpro:
tpro is one o t'e AIX le2acy tools t'at proides a detailed proile o
1PU usa2e or eery AIX process ID and name" It 'as been completely
re@ritten or AIX %", and t'e example belo@ uses t'e AIX %"$ syntax"
8ou s'ould reer to AIX %" Perormance 5ools update: Part G or t'e
ne@ syntax"
5'e simplest @ay to inoe t'is command is to use:
3 tpro se x <sleep $-< 3 tpro se x <sleep G-<
At t'e end o ten seconds, or G- seconds, a ne@ ile EEpro"all, or
sleep"pro, is 2enerated t'at contains inormation about @'at
commands are usin2 1PU on t'e system" Searc'in2 or &74+, t'e
inormation loos somet'in2 lie t'e example belo@:
smon:
5'e smon command captures a snaps'ot o t'e current state om memory"
use it @it' t'e ; s@itc' to 2et 2lobal statistics or t'e @'ole
system"
smon is t'e most useul tool at your disposal @'en monitorin2 a Zaa
process, especially natie 'eap" 5'e article <'en se2ments
collide< 2ies examples o 'o@ to use smon P QpidM m to monitor
t'e natie 'eap o a Zaa process on AIX" )ut t'ere is anot'er
ariation, smon P QpidM m r, t'at is ery eectie in identiyin2 natie
'eap ra2mentation" 5'e r s@itc' prints t'e address ran2e in use, so
it 2ies a more accurate ie@ o 'o@ muc' o eac' se2ment is in use" As
an example, loo at t'e partially edited output belo@:
Pid 1ommand Inuse Pin P2sp #irtual Cbit 6t'rd !Pa2e $-%%C
Raa C$C$G G$C C$ %-$-- N 8 N
#sid 4sid 5ype Description !Pa2e Inuse Pin P2sp #irtual
ac 0 mmap mapped to sid b$.% - -
$-. mmap mapped to sid G-e% - -
$Ca a mmap mapped to sid 0$-. - -
.0-c . mmap mapped to sid Cbced - -
badC b mmap mapped to sid b$-G% - -
b$.% @or C%%GC - C%%GC
G-e% @or C%%GC - % C%%GC
0$-. @or C%%GC - % C%%GC
Cbced @or C%%GC - C$ C%%GC
b$-G% @or %-% - - %-%
$0$-- G @or s'mat/mmap C00. - CG .$-
c0C%a @or s'mat/mmap CG% - $ C0%G
.0$-c C @or s'mat/mmap G.-.- - - G.-.-
Addr 7an2e: -""G-C$ a-b. @or s'ared library data $-%
- $ $-C
Addr 7an2e: -""%$ $$. @or process priate %- $ %$
Addr 7an2e: C%G--""C%%G% a%G% $ pers code,/de/F$-0@asl:$0G
$$ -
Addr 7an2e: -""$$
(t'er example:
3 smon ; i % 3 sample ie times at t@o second interals
memory in use pin p2 space siBe inuse ree pin @or pers clnt @or
pers clnt siBe inuse $CG $C%- $G --C $-C.% 0G0 CGC --C - - -0C- $C.
$CG $C%- $G --C $-C.% 0G0 CGC --C - - -0C- $C. $CG $C%- $G --C
$-C.% 0G0 CGC --C - - -0C- $C. $CG $C%- $G --C $-C.% 0G0 CGC --C -
- -0C- $C. $CG $C%- $G --C $-C.% 0G0 CGC --C - - -0C- $C.
In t'is example, t'ere are $CG pa2es o total siBe o memory"
6ultuply t'is number by -0C to see t'e total real memory siBe" In
t'is case t'e total memory is C 6)"
ilemon:
ilemon can be used to identiy t'e iles t'at are bein2 used most
actiely" 5'is tool 2ies a ery compre'ensie ie@ o ile access, and
can be useul or drillin2 do@n once mstat/iostat conirm dis to be a
bottlenec"
4xample:
3 ilemon o /tmp/ilemon"lo2[ sleep C-[ trcstop
5'e 2enerated lo2 ile is Fuite lar2e" Some sections t'at may be
useul are:
%". G C%0 - unix /de/'d:$.%$ $C"G $ $.% - xe$-
/de/mail$:%$ $C"G $ - $.G "xe$-"pop /de/pobox:C $%" $
$ - tst$ /de/mailt$:0- "G $$. G. - pass@d /de/'d:-%
G" $ $- $ serices /de/'d:C% """ Detailed
&ile Stats
&I!4: /ar/spool/mail//xe$- olume: /de/mail$
=/ar/spool/mail/> inode: %$ opens: $ total bytes
xrd: $.$---- reads: $.% =- errs> read siBes
=bytes>: a2 -0C"- min -0C max -0C sde -"- read times
=msec>: a2 -"%G min -"-$$ max ."-C- sde ".%G """
curt:
curt 1ommand Purpose 5'e 1PU UtiliBation 7eportin2 5ool =curt>
command conerts an AIX trace ile into a number o statistics related
to 1PU utiliBation and eit'er process, t'read or pt'read actiity"
5'ese statistics ease t'e tracin2 o speciic application actiity"
curt @ors @it' bot' uniprocessor and multiprocessor AIX #ersion and
AIX #ersion % traces"
Syntax curt i inputile o outputileV n 2ennamesileV m trcnmileV a
pidnameileV timestampV
l timestampV e'pstPV
Description 5'e curt command taes an AIX trace ile as input and
produces a number o statistics related to processor =1PU>
utiliBation and process/t'read/pt'read actiity" It @ill @or @it'
bot' uniprocessor and multiprocessor AIX traces i t'e processor
clocs are properly sync'roniBed"
2enld:
2enld 1ommand
Purpose 5'e 2enld command extracts t'e list o s'ared obRects
currently loaded onto t'e system and displays t'e address, siBe,
and pat' name or eac' obRect on t'e list"
Syntax 2enld
Description &or s'ared obRects loaded onto t'e system, t'e
ernel maintains a lined list consistin2 o data structures called
loader entries" A loader entry contains t'e name o t'e obRect, its
startin2 address, and its siBe" 5'is inormation is 2at'ered and
reported by t'e 2enld command"
Implementation Speciics 5'is command is alid only on t'e P(47based
platorm"
4xamples 5o obtain a list o loaded s'ared obRects, enter:
3 2enld
etc""
$""$ Not so @ell no@n tools or AIX: t'e proc tools:
9999999999999999999999999999999999999999999999999999999
3 proctree $$CC $$G /usr/sbin/srcmstr $$CC
/usr/sbin/rsct/bin/I)6"Audit76d
5o display t'e ancestors and c'ildren o process $$CC, includin2
c'ildren o process -, enter:
3proctree a $$CC $ /etc/init $$G /usr/sbin/srcmstr
$$CC /usr/sbin/rsct/bin/I)6"Audit76d
procstac Displays t'e 'exadecimal addresses and symbolic names or
eac' o t'e stac rames o t'e current t'read in processes" 5o display
t'e current stac o process $%-%, enter:
3 procstac $%-% $%-% : /usr/sbin/snmpd d-%ab- select =J, J, J, J,
J> 0- $---$% main =J, J, J> $$ $----$ EEstart => c
1urrently, procstac displays 2arba2e or @ron2 inormation or t'e top
stac rame, and possibly or t'e second top stac rame" Sometimes it
@ill erroneously display <No rames ound on t'e stac,< and
sometimes it @ill display: deadbee JJJJJJJJ =J, J, J, J, J, J, J,
J, J, J, J, J, """> 5'e ix or t'is problem 'ad not been released
at t'e @ritin2 o t'is article" 'en t'e ix becomes aailable, you
need to do@nload t'e APA7 I8%G or %"" &or AIX %"G it all s'ould
@or ("
procmap Displays a process address map" 5o display t'e address
space o process $G-, enter:
3 procmap $G- $G- : /usr/sbin/biod C $------- G read/exec biod
----0$- - read/@rite biod d--G$-- .0 read/exec /usr/lib/libicon"a
--$Gb- $ read/@rite /usr/lib/libicon"a d--.a$-- G read/exec
/usr/lib/libi$n"a --$$G. read/@rite /usr/lib/libi$n"a d--.--- $$
read/exec /usr/lib/nls/loc/enEUS d--..$G- read/@rite
/usr/lib/nls/loc/enEUS d--.G- read/exec /usr/lib/libcrypt"a -Gc.%-
- read/@rite /usr/lib/libcrypt"a d-$de- $00. read/exec
/usr/lib/libc"a -GG.e0- %.- read/@rite /usr/lib/libc"a
procldd Displays a list o libraries loaded by a process" 5o display
t'e list o dynamic libraries loaded by process $$0, enter
3 procldd $$0" 5 $$0 : s'
/usr/lib/nls/loc/enEUS /usr/lib/libcrypt"a
/usr/lib/libc"a
procla2s Displays a process tracin2 la2s, and t'e pendin2 and
'oldin2 si2nals" 5o display t'e tracin2 la2s o process $G,
enter:
3 procla2s $G $G : /usr/sbin/rsct/bin/I)6"Host76d data model 9
EI!PG la2s 9 P7E&(7 /C.CG: la2s 9 P7EAS!44P ? P7EN(74;S /CCG$%:
la2s 9 P7EAS!44P ? P7EN(74;S /C-C$: la2s 9 P7EAS!44P ? P7EN(74;S
/CC.: la2s 9 P7EAS!44P ? P7EN(74;S /.%$%: la2s 9 P7EAS!44P ?
P7EN(74;S /.-G0: la2s 9 P7EAS!44P ? P7EN(74;S /CC-C$: la2s 9
P7EAS!44P ? P7EN(74;S /C0$0: la2s 9 P7EAS!44P ? P7EN(74;S
procsi2 !ists t'e si2nal actions or a process" 5o list all t'e
si2nal actions deined or process G-%%, enter:
3 procsi2 G-%% G-%% : s' HUP cau2't IN5 cau2't +UI5 cau2't I!!
cau2't 57AP cau2't A)75 cau2't 465 cau2't &P4 cau2't I!! deault
74S5A75 )US cau2't
proccred Prints a process credentials" 5o display t'e credentials o
process %CG, enter:
3 proccred %CG %CG: e/r/suid9- e/r/s2id9-
prociles
Prints a list o open ile descriptors" 5o display status and control
inormation on t'e ile descriptors opened by process -$G,
enter:
3 prociles n -$G -$G : /usr/sbin/rsct/bin/I)6"1S6A2ent76d
1urrent rlimit: $.GC. ile descriptors -: SEI&1H7 mode:--
de:$-, ino:$. uid:- 2id:- rde:, (E7D7 name:/de/null :
SEI&74; mode:-G$$ de:$-,C ino:%- uid:- 2id:- rde:-,-
(E7D7 siBe:- name:/ar/ct/I)6"1S6A2ent76"stderr : SEI&74;
mode:--- de:$-,C ino:%% uid:- 2id:- rde:-,-
proc@dx Prints t'e current @orin2 directory or a process" 5o
display t'e current @orin2 directory o process $$0, enter:
3 proc@dx $$0 $$0 : /'ome/2uest
procstop Stops a process" 5o stop process .%-- on t'e P7E74+U4S54D
eent, enter:
3 procstop .%-- "
procrun 7estart a process" 5o restart process G-$0 t'at @as stopped
on t'e P7E74+U4S54D eent, enter:
3 procrun G-$0 "
proc@ait aits or all o t'e speciied processes to terminate" 5o @ait
or process $0 to exit and display t'e status, enter
3 proc@ait $0 " $0 : terminated, exit status -
$""$% (t'er monitorin2: 999999999999999999999999
Na2ios: open source 6onitorin2 or most unix systems:
Na2ios is an open source 'ost, serice and net@or monitorin2
pro2ram"
!atest ersions: "% =stable>
Na2ios is a 'ost and serice monitor desi2ned to inorm you o net@or
problems beore your clients, endusers or mana2ers do" It 'as been
desi2ned to run under t'e !inux operatin2 system, but @ors ine
under most *NIX ariants as @ell" 5'e monitorin2 daemon runs
intermittent c'ecs on 'osts and serices you speciy usin2 external
<plu2ins< @'ic' return status inormation to Na2ios" 'en
problems are encountered, t'e daemon can send notiications out to
administratie contacts in a ariety o dierent @ays =email, instant
messa2e, S6S, etc">" 1urrent status inormation, 'istorical lo2s,
and reports can all be accessed ia a @eb bro@ser"
System 7eFuirements
5'e only reFuirement o runnin2 Na2ios is a mac'ine runnin2 !inux
=or UNIX ariant> and a 1 compiler" 8ou @ill probably also @ant
to 'ae 51P/IP coni2ured, as most serice c'ecs @ill be perormed oer
t'e net@or"
8ou are not reFuired to use t'e 1;Is included @it' Na2ios" Ho@eer,
i you do decide to use t'em, you @ill need to 'ae t'e ollo@in2
sot@are installed"""
A @eb serer =preerrably Apac'e> 5'omas )outells 2d library
ersion $"C"G or 'i2'er =reFuired by t'e statusmap and trends
1;Is>
rstat: 6onitorin2 6ac'ine UtiliBation @it' rstat:
rstat stands or 7emote System Statistics serice
Ports exist or most unixes, lie !inux, Solaris, AIX etc""
rstat on !inux, Solaris:
rstat is an 7P1 client pro2ram to 2et and print statistics rom any
mac'ine runnin2 t'e rpc"rstatd daemon, its sererside counterpart"
5'e rpc"rstad daemon 'as been used or many years by tools suc' as
Suns permeter and t'e rup command" 5'e rstat pro2ram is simply a
ne@ client or an old daemon" 5'e act t'at t'e rpc"rstatd daemon is
already installed and runnin2 on most Solaris and !inux mac'ines is
a 'u2e adanta2e oer ot'er tools t'at reFuire t'e installation o
custom a2ents"
8ou can 2et statistics @it'out lo22in2 in to t'e remote mac'ine,
includin2 oer t'e Internet"
It includes a timestamp"
5'e output can be plotted directly by 2nuplot"
5'e act t'at it runs remotely means t'at you can use a sin2le
central mac'ine to monitor t'e perormance o many remote mac'ines"
It also 'as a disadanta2e in t'at it does not 2ie t'e useul scan
rate measurement o memory s'orta2e, t'e sr column in mstat" rstat
@ill not @or across most ire@alls because it relies on port $$$,
t'e 7P1 port, @'ic' is usually bloced by ire@alls"
5o use rstat, simply 2ie it t'e name or IP address o t'e mac'ine
you @is' to monitor" 7emember t'at rpc"rstatd must be runnin2 on
t'at mac'ine" 5'e rup command is extremely useul 'ere because @it'
no ar2uments, it simply prints out a list o all mac'ines on t'e
local net@or t'at are runnin2 t'e rstatd demon" I a mac'ine is not
listed, you may 'ae to start rstatd manually"
5o start rpc"rstatd under 7ed Hat !inux, run
3 /etc/rc"d/init"d/rstatd start as root"
(n Solaris, irst try runnin2 t'e rstat client because inetd is oten
already coni2ured to automatically start rpc"rstatd on reFuest" I
it t'e client ails @it' t'e error <7P1: Pro2ram not
re2istered,< mae sure you 'ae t'is line in your
/etc/inet/inetd"con and ill HUP your inetd process to 2et it to
reread inetd"con, as ollo@s:
rstatd/ tli rpc/data2ramE @ait root /usr/lib/netsc/rstat/rpc"rstatd
rpc"rstatd
5'en you can monitor t'at mac'ine lie t'is:
rstat enidu --$ -. $- $- GC - - - - $-- - . % $ - - $ -"$
5'is command @ill 2ie you a onesecond aera2e and t'en it @ill exit"
I you @ant to continuously monitor, 2ie an interal in seconds on
t'e command line" Heres an example o one line o output eery t@o
seconds:
--$ -. $- $- GC G - - - $-- - % $- - - $0 -"- --$ -. $- $- GC GC -
- - $-- - - C - - $- -"- O1
5o 2et a usa2e messa2e, t'e output ormat, t'e ersion number, and
@'ere to 2o or updates, Rust type rstat @it' no parameters:
rstat usa2e: rstat mac'ine interalV output: yyyy mm dd '' mm ss usr
@io sys idl p2in p2out intr ipts opts coll cs load docs and src at
'ttp://patric"net/sot@are/rstat/rstat"'tml
Notice t'at t'e column 'eadin2s line up @it' t'e output data"
AIX:
In order to 2et rstat @orin2 on AIX, you may need to coni2ure
rstatd"
As root
$" 4dit /etc/inetd"con Uncomment or add entry or rstatd 42 rstatd
sunrpcEudp udp @ait root /usr/sbin/rpc"rstatd rstatd $----$
$G
" 4dit /etc/serices Uncomment or add entry or rstatd 42 rstatd
$----$/udp
G" 7eres' serices reres' s inetd
" Start rstatd /usr/sbin/rpc"rstatd
$""$C UNIX 477(7 1(D4S: 999999999999999999999999
Its al@ays <'andy< to 'ae a list o errcodes rom t'e errno"'
'eaderile" It s'ould be reasonable t'e same accross t'e unix
ersions"
Actually, t'is is only a ery small list o errors and code" It is
(N!8 associated @it' t'e interaction o a process @it' t'e
system"
error lo22in2 daemon mi2't @rite in a lo2ile, is a ery dierent
story"
rom t'e errno"' ile:
MMM 4rrcodes !inux =2eneric>:
3deine 4P&N(SUPP(75 0C /* Protocol amily not supported */
3deine 4A&N(SUPP(75 0. /* Address amily not supported by
protocol */ 3deine 4ADD7INUS4 0 /* Address already in use */ 3deine
4ADD7N(5A#AI! 00 /* 1annot assi2n reFuested address */ 3deine
4N45D(N $-- /* Net@or is do@n */ 3deine 4N45UN74A1H $-$ /* Net@or
is unreac'able */ 3deine 4N4574S45 $- /* Net@or dropped connection
because o reset */ 3deine 41(NNA)(754D $-G /* Sot@are caused
connection abort */ 3deine 41(NN74S45 $- /* 1onnection reset by
peer */ 3deine 4N()U&S $-% /* No buer space aailable */ 3deine
4IS1(NN $-C /* 5ransport endpoint is already connected */ 3deine
4N(51(NN $-. /* 5ransport endpoint is not connected */ 3deine
4SHU5D(N $- /* 1annot send ater transport endpoint s'utdo@n */
3deine 45((6AN874&S $-0 /* 5oo many reerences: cannot splice */
3deine 45I64D(U5 $$- /* 1onnection timed out */ 3deine
41(NN74&US4D $$$ /* 1onnection reused */ 3deine 4H(S5D(N $$ /*
Host is do@n */ 3deine 4H(S5UN74A1H $$G /* No route to 'ost */
3deine 4A!74AD8 $$ /* (peration already in pro2ress */ 3deine
4INP7(;74SS $$% /* (peration no@ in pro2ress */ 3deine 4S5A!4 $$C
/* Stale N&S ile 'andle */ 3deine 4U1!4AN $$. /* Structure
needs cleanin2 */ 3deine 4N(5NA6 $$ /* Not a X4NIX named type ile
*/ 3deine 4NA#AI! $$0 /* No X4NIX semap'ores aailable */ 3deine
4ISNA6 $- /* Is a named type ile */ 3deine 4746(54I( $$ /* 7emote
I/( error */ 3deine 4D+U(5 $ /* +uota exceeded */ 3deine 4N(64DIU6
$G /* No medium ound */ 3deine 464DIU658P4 $ /* ron2 medium type
*/
5'e list aboe s'ould actually be enou2', but @e s'all list t'e same
or AIX:
MMM errcodes AIX:
3deine 4N4574S45 .$ /* Net@or dropped connection on reset */ 3deine
41(NNA)(754D . /* Sot@are caused connection abort */ 3deine
41(NN74S45 .G /* 1onnection reset by peer */ 3deine 4N()U&S .
/* No buer space aailable */ 3deine 4IS1(NN .% /* Socet is already
connected */ 3deine 4N(51(NN .C /* Socet is not connected */ 3deine
4SHU5D(N .. /* 1ant send ater socet s'utdo@n */ 3deine 45I64D(U5 .
/* 1onnection timed out */ 3deine 41(NN74&US4D .0 /* 1onnection
reused */ 3deine 4H(S5D(N - /* Host is do@n */ 3deine 4H(S5UN74A1H
$ /* No route to 'ost */ 3deine 474S5A75 /* restart t'e system call
*/ 3deine 4P7(1!I6 G /* 5oo many processes */ 3deine 4US47S /* 5oo
many users */ 3deine 4!((P % /* 5oo many leels o symbolic lins */
3deine 4NA645((!(N; C /* &ile name too lon2 */ 3deine 4D+U(5 /*
Disc Fuota exceeded */ 3deine 41(77UP5 0 /* Inalid ile system
control data */ 3deine 4746(54 0G /* Item is not local to 'ost */
3deine 4N(S8S $-0 /* &unction not implemented P(SIX */ 3deine
464DIA $$- /* media surace error */ 3deine 4S(&5 $$$ /* I/(
completed, but needs relocation */ 3deine 4N(A557 $$ /* no
attribute ound */ 3deine 4SAD $$G /* security aut'entication denied
*/ 3deine 4N(57US5 $$ /* not a trusted pro2ram */ 3deine
45((6AN874&S $$% /* 5oo many reerences: cant splice */ 3deine
4I!S4+ $$C /* Inalid @ide c'aracter */ 3deine 41AN14!4D $$. /*
async'ronous i/o cancelled */ 3deine 4N(S7 $$ /* temp out o streams
resources */ 3deine 45I64 $$0 /* IES57 ioctl timed out */ 3deine
4)AD6S; $- /* @ron2 messa2e type at stream 'ead */ 3deine 4P7(5( $$
/* S574A6S protocol error */ 3deine 4N(DA5A $ /* no messa2e ready
at stream 'ead */ 3deine 4N(S57 $G /* d is not a stream */ 3deine
41!(N464 474S5A75 /* t'is is t'e @ay @e clone a stream """ */
3deine 4N(5SUP $ /* P(SIX t'reads unsupported alue */ 3deine
46U!5IH(P $% /* multi'op is not allo@ed */ 3deine 4N(!IN $C /* t'e
lin 'as been seered */ 3deine 4(#47&!( $. /* alue too lar2e to
be stored in data type */
9999999999999999999999999999999999 " N&S and 6ount command
examples: 9999999999999999999999999999999999
!ets start @it' somet'in2 t'at mi2't be o interrest ri2't
no@:
4xamples o mountin2 a D#D or 1D7(6:
99999999999999999999999999999999999
AIX: 3 mount r cdrs /de/cd- /cdrom
Solaris: 3 mount r & 'ss /de/ds/c-tCd-s /cdrom
HPUX:
mount & cds o rr /de/ds/c$td- /cdrom
SuS4 !inux: 3 mount t iso0CC- /de/cdrom /cdrom 3 mount t iso0CC-
/de/cdrom /media/cdrom
7ed'at !inux: 3 mount t iso0CC- /de/cdrom /media/cdrom
(t'er commands on !inux:
Sometimes on some !inux, and some scsi 1D7(6 deices, you mi2't
try
3 mount /de/sr- /mountEpoint 3 mount t iso0CC- /de/sr-
/mountEpoint
No@ @e return to a discussion o <mountin2< and N&S"
"$ N&S: 99999999
e @ill discuss t'e most important eaures o N&S, by s'o@in2 'o@
its implemented on Solaris, 7ed'at and SuS4 !inux" 6ost o t'is
applies to HPUX and AIX as @ell"
"$"$ N&S and 7ed'at !inux:
!inux uses a combination o ernelleel support and continuously
runnin2 daemon processes to proide N&S ile s'arin2, 'o@eer,
N&S support must be enabled in t'e !inux ernel to unction"
N&S uses 7emote Procedure 1alls =7P1> to route reFuests
bet@een clients and serers, meanin2 t'at t'e portmap serice must be
enabled and actie at t'e proper runleels or N&S communication
to occur" orin2 @it' portmap, arious ot'er processes ensure t'at a
particular N&S connection is allo@ed and may proceed @it'out
error:
rpc"mountd 5'e runnin2 process t'at receies t'e mount reFuest rom
an N&S client and c'ecs to see
i it matc'es @it' a currently exported ile system" rpc"nsd 5'e
process t'at implements t'e userleel part o t'e N&S serice" It
@ors @it' t'e !inux ernel
to meet t'e dynamic demands o N&S clients, suc' as proidin2
additio