May 17, 2012
Solaris performance(3): how to gather performance data from CPU , memory , disks and network in a row!
I’m writing a monster script useful for gather performance data. It’s based on multiple collectors i wrote for data collecting and plotting.
I actually wrote the main, main.sh . This is a screenshot.
I’m very funny to write this after months reading about Solaris internal , performance , dtrace !
My goal is to get data from every Solaris consumer and make graphic reports, as i did in the past, playing like that
May 16, 2012
Using EOF in a shell script
Today i was writing a shell script. During this task i encountered a problem with EOF ( End Of File ).
After i found the cause and i’m still thinking to this , i did not know this info !
Follow an example here:
./test.sh: line 11: syntax error: unexpected end of file
root@server1 #
!?!?
After i tried to don’t indent EOF… i did not know which was the cause of this problem.
So , the script changed in this:
root@server1 # ./test.sh
this is a test
root@server1 #
It worked !
February 21, 2012
Added 1line repository!!
Today i moved my source codes from the old website to google documents format.
This time i did a repository , called 1line !
i want to put there all the commands or utility written in 1 line
This repository is available here
June 8, 2011
Solaris: how label few disks in one line
Some days ago a Veritas technician asked me:
“i need to label few LUN assigned to this system. How i could do this shortly?”
We founded together the solution.
This is a one liner command used for this purpose.
In another situation i could use the same procedure for set the volname of few disks , for example.
January 28, 2011
Solaris seq script
Yesterday i wrote this simple script, useful for numeric sequence.
The syntax is like seq on Linux, for example:
./seq 5 10
5
6
7
8
9
10
April 28, 2010
Solaris : disable SMC ( Sun Management Console )
For security reason , today i must disable Sun Management Console on a few Solaris server , 8 – 9 – 10.
I wrote a single command for every Solaris version.
It is listed here.
Useful and quick for me
April 6, 2010
Solaris diskinfo utility
Some days ago i wrote with Emanuel this script.
When on a system disks are used in slice format ( not used in SVM , VxVM , ZFS ) this tool is useful for obtain free space information.
Follow this example:
# df -h
File system dim. usati disp. capacità Attivato su
/dev/dsk/c1t0d0s0 15G 5,1G 9,5G 35% /
/devices 0K 0K 0K 0% /devices
ctfs 0K 0K 0K 0% /system/contract
proc 0K 0K 0K 0% /proc
mnttab 0K 0K 0K 0% /etc/mnttab
swap 29G 964K 29G 1% /etc/svc/volatile
objfs 0K 0K 0K 0% /system/object
sharefs 0K 0K 0K 0% /etc/dfs/sharetab
/dev/dsk/c1t0d0s4 5,9G 2,9G 3,0G 50% /usr
/usr/lib/libc/libc_hwcap1.so.1
5,9G 2,9G 3,0G 50% /lib/libc.so.1
fd 0K 0K 0K 0% /dev/fd
/dev/dsk/c1t0d0s3 3,9G 1,5G 2,4G 40% /var
swap 29G 52K 29G 1% /tmp
[output omitted]
I run diskinfo
# ./diskinfo
Usage:./diskinfo {list|all}
./diskinfo list – for see total dimension of every path
./diskinfo all – for see free space# ./diskinfo list
c1t0d0 : 46G
c1t1d0 : 87G
c1t2d0 : 311G
c1t3d0 : 419G
c1t4d0 : 199G
c1t5d0 : 9G
For see free space on every disk
# ./diskinfo all
Disk c1t0d0 : 46G
Free Space : 7MDisk c1t1d0 : 87G
Free Space : 0M[output omitted]
Just for be clear this is the output of format command ( it be compared with diskinfo output )
format
Searching for disks…doneAVAILABLE DISK SELECTIONS:
0. c1t0d0
/pci@0,0/pci1000,30@10/sd@0,0
1. c1t1d0
/pci@0,0/pci1000,30@10/sd@1,0
2. c1t2d0
/pci@0,0/pci1000,30@10/sd@2,0
3. c1t3d0
/pci@0,0/pci1000,30@10/sd@3,0
4. c1t4d0
/pci@0,0/pci1000,30@10/sd@4,0
5. c1t5d0
/pci@0,0/pci1000,30@10/sd@5,0
Specify disk (enter its number): 0
selecting c1t0d0
[disk formatted]
Warning: Current Disk has mounted partitions.
/dev/dsk/c1t0d0s0 is currently mounted on /. Please see umount(1M).
/dev/dsk/c1t0d0s1 is currently used by swap. Please see swap(1M).
/dev/dsk/c1t0d0s3 is currently mounted on /var. Please see umount(1M).
/dev/dsk/c1t0d0s4 is currently mounted on /usr. Please see umount(1M).
/dev/dsk/c1t0d0s6 is currently mounted on /export/home. Please see umount(1M).FORMAT MENU:
disk – select a disk
type – select (define) a disk type
partition – select (define) a partition table
current – describe the current disk
format – format and analyze the disk
fdisk – run the fdisk program
repair – repair a defective sector
label – write label to the disk
analyze – surface analysis
defect – defect list management
backup – search for backup labels
verify – read and display labels
save – save new disk/partition definitions
inquiry – show vendor, product and revision
volname – set 8-character volume name
! – execute , then return
quit
format> pPARTITION MENU:
0 – change `0′ partition
1 – change `1′ partition
2 – change `2′ partition
3 – change `3′ partition
4 – change `4′ partition
5 – change `5′ partition
6 – change `6′ partition
7 – change `7′ partition
select – select a predefined table
modify – modify a predefined partition table
name – name the current table
print – display the current table
label – write partition map and label to the disk
! – execute , then return
quit
partition> p
Current partition table (original):
Total disk cylinders available: 6132 + 2 (reserved cylinders)Part Tag Flag Cylinders Size Blocks
0 root wm 1 – 1959 15.01GB (1959/0/0) 31471335
1 swap wu 3920 – 6130 16.94GB (2211/0/0) 35519715
2 backup wm 0 – 6131 46.97GB (6132/0/0) 98510580
3 var wm 1960 – 2482 4.01GB (523/0/0) 8401995
4 usr wm 2483 – 3266 6.01GB (784/0/0) 12594960
5 unassigned wm 0 0 (0/0/0) 0
6 home wm 3267 – 3919 5.00GB (653/0/0) 10490445
7 unassigned wm 0 0 (0/0/0) 0
8 boot wu 0 – 0 7.84MB (1/0/0) 16065
9 unassigned wm 0 0 (0/0/0) 0
This is really useful where i must work in delivery systems !
Here there is the code
December 15, 2009
Solaris 10 patch parser tool
Unfortunately Sun Microsystems doesn’t have a tool for this purpose.
Due to customer requestes , i wrote this tool that compare every patch between global and local zones ( native or branded) , or just between local zones.
In this example i ran it for parsing of solaris 8 zones:
# perl patchparser.pl
Syntax: patchparser.pl { -a | -g | -n | -b }
-a : compare patches between global zone and all running native local zone
-g : compare patches between two or more global zone
-n : compare patches between native running zones only
-b8 : compare patches between Solaris 8 branded running zones only
-b9 : compare patches between Solaris 9 branded running zones only#perl patchparser.pl -b8
[...]
Missing patch 108435-22 on zone local47
Missing patch 109862-04 on zone local57
Missing patch 110927-01 on zone local72
On wordpress i’m trying to upload this script but it seems that i can upload only jpg/pdf/bmp files.
So , this is the link to download the code.
April 30, 2009
Show the status of LUN and path on Solaris
For this purpose i used these commands:
for i in `luxadm probe | grep Path | cut -f 2 -d ‘:’`; do echo “Processing $i:”; sleep 1; luxadm display $i | egrep -i ‘(status|state)’; echo; done
When running i obtain:
Processing /dev/rdsk/c2t5006048452A70A28d0s2:
Path status: O.K.
Path status: O.K.
Path status: O.K.
Path status: O.K.Processing /dev/rdsk/c2t5006048452A70A28d236s2:
Path status: O.K.Processing /dev/rdsk/c2t5006048452A70A28d237s2:
Path status: O.K.Processing /dev/rdsk/c2t5006048452A70A28d238s2:
Path status: O.K.
Path status: O.K.
Path status: O.K.
Path status: O.K.[...]
From output i can see the number of path of every LUN , useful!