Script :
#!/usr/bin/ksh
vxprint | grep Disk |awk {'print $3'} | grep -v rootdg >/var/tmp/dgname
printf "\n......................................................................\n"
printf "Server Name : "
hostname
cat /var/tmp/dgname | while read dgnames
do
printf "......................................................................\n"
printf "\nDiskGroup Name : $dgnames "
vxprint -g $dgnames | grep ^dm |awk 'BEGIN {TOT=0} {TOT=TOT+$5} END{print " Total Size of the DG=" TOT/2/1024" MB ("TOT/2/1024/1024" GB)\n"}'
vxprint -g $dgnames | grep ^v | awk '{print "Volume : " $2" " $5/2/1024 " MB (" $5/2/1024/1024 "GB)"}'
printf "\nAvailable space in $dgnames = "
vxassist -g $dgnames maxsize| awk '{print $5}'
done
printf "......................................................................\n"
Output :
......................................................................
Server Name : SolarisVM
......................................................................
DiskGroup Name : datadg Total Size of the DG=415733 MB (405.989 GB)
Volume : Bla_vg 100 MB (0.0976562GB)
Volume : Datavol 102400 MB (100GB)
Volume : WEB 15360 MB (15GB)
Volume : fvol 73728 MB (72GB)
Volume : insvol 76800 MB (75GB)
Volume : spare 6144 MB (6GB)
Available space in datadg = (2945Mb)
......................................................................
DiskGroup Name : unixdg Total Size of the DG=173636 MB (169.567 GB)
Volume : exp 30720 MB (30GB)
Available space in unixdg = (142915Mb)
......................................................................
Command Line Scripts
For Calculate 5th column of ls -l output:
root@vidyavathi # ls -l
total 2
-rw-r--r-- 1 root root 0 Sep 22 17:40 datadg01
drwxr-xr-x 2 root root 96 Sep 22 16:49 lost+found
-rw-r--r-- 1 root root 38 Sep 22 16:53 nila
root@vidyavathi # ls -l | ls -l | awk 'BEGIN{SUM=0} {SUM=SUM+$5} END{print "Column 5 Total =" SUM}'
Column 5 Total =134
root@vidyavathi #
root@vidyavathi # ls -l
total 2
-rw-r--r-- 1 root root 0 Sep 22 17:40 datadg01
drwxr-xr-x 2 root root 96 Sep 22 16:49 lost+found
-rw-r--r-- 1 root root 38 Sep 22 16:53 nila
root@vidyavathi # ls -l | ls -l | awk 'BEGIN{SUM=0} {SUM=SUM+$5} END{print "Column 5 Total =" SUM}'
Column 5 Total =134
root@vidyavathi #
Subscribe to:
Posts (Atom)
