“prstat -va” equivalent for linux.

Solaris has “prstat -va” when you want to know which process is using %SYS cpu.
#prstat -va
PID USERNAME USR
SYS
TRP TFL DFL LCK SLP LAT VCX ICX SCL SIG PROCESS/NLWP
4188 rdircio 3.0 0.2 0.0 0.0 0.0 0.0 97 0.0 91 26 826 0 nxagent/1
19877 root 1.0 0.0 0.0 0.0 0.0 0.0 99 0.0 3 4 115 0 ssh/1
22010 rdircio 0.2 0.8 0.0 0.0 0.0 0.0 99 0.0 46 4 916 0 prstat/1
Notice the SYS column.
Linux standard “top” does not have that. so we can use “atop”: http://www.atcomputing.nl/Tools/atop/
# atop
PID
SYSCPU
USRCPU VGROW RGROW USERNAME THR ST EXC S CPU CMD 1/1
23876 8.18s 1.43s 0K 0K wbmthds 1 — – R 100% gam_server
13785 0.14s 0.03s 0K 0K root 1 — – S 2% atop
x y z 0.06s 0.02s 0K 0K smmsp 0 NE 0 E 1% <sendmail>
x y z 0.06s 0.01s 0K 0K root 0 NE 0 E 1% <accountunloc>
25971 0.02s 0.01s 0K 0K wbmthds 79 — – S 0% awbroker
14113 0.02s 0.00s 0K 0K root 1 — – R 0% atop
Hope this helps for your performance/sysstat needs
132/433

routes

If when you do netstat -rn you see routes that look the same…
bash-3.00$ netstat -rn
Routing Table: IPv4
Destination Gateway Flags Ref Use Interface
——————– ——————– —– —– —— ———
198.148.129.64 198.148.129.110 U 1 385521 ce0:1
198.148.129.64 198.148.129.98 U 1 0 ce0:2
198.148.129.64 198.148.129.110 U 1 0 ce0
198.148.129.64 198.148.129.110 U 1 346097 qfe0
To differentiate them do a netstat -nrv
bash-3.00$ netstat -nrv
IRE Table: IPv4
Destination Mask Gateway Device Mxfrg Rtt Ref Flg Out In/Fwd
——————– ————— ——————– —— —– —– — — —– ——
198.148.129.64 255.255.255.192 198.148.129.110 ce0:1 1500* 0 1 U 385521 0
198.148.129.64 255.255.255.192 198.148.129.98 ce0:2 1500* 0 1 U 0 0
198.148.129.64 255.255.255.192 198.148.129.110 ce0 1500* 0 1 U 0 0
198.148.129.64 255.255.255.192 198.148.129.110 qfe0 1500* 0 1 U 346097 0
then you can add/delete, differentiating them by the netmask, like:
route delete 198.148.129.64 198.148.129.110 255.255.255.192
Thanks to Alejandro Siller
220/433

Powerpath, Mpxio or Vxdmp

You want to know what DMP technology you are using at your server, and if having it activated, how do you see the
 disks....
 Wrote this script:
 #!/bin/ksh
 echo "running check"
 (
 echo "MPXIO ?"
 echo "---------------------------------------------------"
 modinfo | grep -i vhci
 M=`modinfo |grep -i vhci | wc -l`
 if [ $M -gt 0 ];then
 echo "enabled"
 else
 echo "disabled"
 fi
 echo ""
 echo "POWERPATH ?"
 echo "---------------------------------------------------"
 modinfo | grep -i emcp
 P=`modinfo |grep -i emcp | wc -l`
 if [ $P -gt 0 ];then
 echo "enabled"
 else
 echo "disabled"
 fi
 echo ""
 echo "VXDMP ?"
 echo "---------------------------------------------------"
 modinfo | grep -i vxdmp
 V=`modinfo |grep -i vxdmp | wc -l`
 if [ $V -gt 0 ];then
 echo "enabled"
 else
 echo "disabled"
 fi
 echo ""
 if [ $P -gt 0 ];then
 echo "POWERPATH"
 echo "---------------------------------------------------"
 /etc/powermt display dev=all
 fi
 if [ $V -gt 0 ];then
 echo "VXDMP"
 echo "---------------------------------------------------"
 205/433
 vxdmpadm listctlr all
 fi
 if [ $M -gt 0 ];then
 echo "LUXADM"
 echo "---------------------------------------------------"
 for d in `format < /dev/null| egrep 'HIT|EMC' | awk '{ print $2 }'`;do
 echo $d
 luxadm display /dev/rdsk/${d}s2
 done
 fi
 if [ -f /usr/sbin/vxdisk ];then
 echo "VXDISK LIST"
 echo "---------------------------------------------------"
 for d in `/usr/sbin/vxdisk -o alldgs list| awk '{ print $1 }'`;do
 echo $d
 /usr/sbin/vxdisk list $d
 done
 fi
 ) > /tmp/results_`uname -n`.txt
 echo "finished running check"
 Run it, relax, and enjoy
 Thx to Hiram Ruiz and Corey Joiner
 And YES
 This site has been back on Slackware 11 since at least 1 month.
 - rdircio
 206/433

RDAC

if you see some “rdnexus” strings in your format output, you have RDAC (and yes, it is a disease)
32. c9t0d14 <STK-OPENstorageD220-0533 cyl 34965 alt 2 hd 64 sec 64>
/pseudo/rdnexus@4/rdriver@0,e
RDAC is a multipathing software, (like vxdmp or powerpath). Other symptom includes finding the module
loaded.
bash-2.03# modinfo | grep rd
42 103231bf 8f2 235 1 rdnexus (RDAC Pseudo Controller Driver)
43 1032391b 19fb4 236 1 rdriver (Solaris RDAC Driver)
well, you can find out how the paths are shown by issuing:
bash-2.03# SMdevices
SANtricity Storage Manager Devices, Version 08.30.02.00
Built Wed Sep 11 15:25:19 CDT 2002
Copyright (C) 2001 LSI Logic Corporation. All rights reserved.
Copyright (C) 2001 Storage Technology Corporation. All rights reserved.
/dev/rdsk/c5t0d11s2 [Disk Subsystem ImageDisk1, Volume Volume 12, LUN 11, Volume WWN
<600a0b80000f9d5300000014464c4753>, Preferred Path (Controller-B): In Use ]
/dev/rdsk/c5t0d13s2 [Disk Subsystem ImageDisk1, Volume Volume 14, LUN 13, Volume WWN
<600a0b80000f9d5300000015464c47a1>, Preferred Path (Controller-B): In Use ]
/dev/rdsk/c6t0d3s2 [Disk Subsystem ImageDisk2, Volume Volume 4, LUN 3, Volume WWN
<600a0b80001318bd000010c540605ca1>, Preferred Path (Controller-B): In Use]
/dev/rdsk/c6t0d1s2 [Disk Subsystem ImageDisk2, Volume Volume 2, LUN 1, Volume WWN
<600a0b80001318bd000010bd400ceaa7>, Preferred Path (Controller-B): In Use]
/dev/rdsk/c3t0d0s2 [Disk Subsystem ImageDisk2, Volume Volume 1, LUN 0, Volume WWN
<600a0b800013186 c000010d9400cea9e>, Preferred Path (Controller-A): In Use]
/dev/rdsk/c3t0d2s2 [Disk Subsystem ImageDisk2, Volume Volume 3, LUN 2, Volume WWN
<600a0b800013186 c000010e440605c8e>, Preferred Path (Controller-A): In Use]
/dev/rdsk/c3t0d10s2 [Disk Subsystem ImageDisk2, Volume Volume 11, LUN 10, Volume WWN
<600a0b800013186 c000010ef464c4d3a>, Preferred Path (Controller-A): In Use ]
/dev/rdsk/c9t0d14s2 [Disk Subsystem ImageDisk1, Volume Volume 15, LUN 14, Volume WWN
<600a0b80001256a 900000038464c4ca2>, Preferred Path (Controller-A): In Use ]
194/433

Parse a top -b output to a csv file

To monitor a machine’s performance, in a very raw manner, you can run top in batch mode and redirect it to a file, like:
# top -b -c 10 > topfile.txt &
then parse the output file/s in a script
#!/bin/ksh
echo “DATE,CPUIDLE,ME MUSED,MEMFREE”
(X=0;
B=””;
awk ‘NF!=12 && length>0’ top* | grep -iv defunct | while read line;do
L=`echo “$X % 5” | bc`
if [ $L -eq 0 ];then
echo “$B”
B=””
fi
B=`echo $B$line | sed ‘s/ /_/g’`
X=`echo “$X + 1” | bc`
done ) | awk -F’_’ ‘{ print $3 “,” $31 “,” $41 “,” $43 }’
This was tested on a linux Suse 9 on IBM OpenPower equipment.
=)
Creating a whole root zone
A whole root zone is a zone that has copies of packages in its own filesystem, not mounted as loopback.
# zonecfg -z wrzone
wrzone: No such zone configured
Use ‘create’ to begin configuring a new zone.
zonecfg:wrzone> create -b
zonecfg:wrzone> set autoboot=true
zonecfg:wrzone> set zonepath=/wrzone
zonecfg:wrzone> add net
zonecfg:wrzone:net> set address=100.100.100.1
zonecfg:wrzone:net> set physical=eri0
zonecfg:wrzone:net> end
zonecfg:wrzone> info
zonepath: /wrzone
autoboot: true
pool:
net:
277/433
address: 100.100.100.1
physical: eri0
zonecfg:wrzone> verify
zonecfg:wrzone> commit
zonecfg:wrzone> exit
#
# cat /etc/zones/wrzone.xml
<?xml version=”1.0″ encoding=”UTF-8″?>
<!DOCTYPE zone PUBLIC “-//Sun Microsystems Inc//DTD Zones//EN”
“file:///usr/share/lib/xml/dtd/zonecfg.dtd.1″>
<!–
DO NOT EDIT THIS FILE. Use zonecfg(1M) instead.
–>
<zone name=”wrzone” zonepath=”/wrzone” autoboot=”true”>
<network address=”100.100.100.1″ physical=”eri0″/>
</zone>
#
# chmod 700 /wrzone
#
# df -h /wrzone
Filesystem size used avail capacity Mounted on
/dev/dsk/c0t1d0s0 7.8G 7.9M 7.7G 1% /wrzone
#
# zoneadm -z wrzone verify
# zoneadm -z wrzone install
Preparing to install zone <wrzone>.
Creating list of files to copy from the global zone.
Copying <118457> files to the zone.
# zoneadm -z wrzone boot
# zlogin -C wrzone
278/433