Assistance needed with script.......



Hello all,

I am somewhat new to perl. I have tried to read everything that I can. I
have a somewhat simple script, so might think. I have attached the script
and the file that I am reading to gather the data. I am trying to parse
this file to gather information and from here I will import the data into a
spread***. I need assistance on this one area with in the script.

I have a few areas in the data file that has information that looks like the
following:

Device Capacity
{
Cylinders : 16
Tracks : 240
512-byte Blocks : 15360
MegaBytes : 8
KiloBytes : 7680
}

What I am trying to do is to gather the data in between the { } so it would
look like such
SymmSerial =>
symmvol =>
$symmvol =>
{DeviceCapacity} =>
{512-byteBlocks} => 15360,
{MegaBytes} => 8,
{KiloBytes} => 7680,

Above, there is only one for each symmvol. I have multiple items like this
I would like to parse from the data file, such as Front Director Paths,
Device Capacity(from above) and Back End Disk Director Information.

All assistance would be great.


------ script ------

#!/usr/bin/perl
use Data::Dumper;
$debug = 0;

while (<>) {
if ( $_ =~ /^Symmetrix ID:\s+(\w+)/ ) {
$symmSerial = substr($1,3);
print "$symmSerial\n" if $debug;
}

if ( /^\s+Device Symmetrix Name\s+: (\w+)/ ) {
$symmvol = $1;
print "$symmvol\n" if $debug;
push (@symmDevices, $symmvol);
}
if ( /^\s+WWN\s+:\s+(\w+)/ ) {
$symmDevWWN = $1;
print "$symmDevWWN\n" if $debug;
$symmHash{"$symmvol"} = "$symmDevWWN";
print "$symmvol ==> $symmDevWWN\n" if $debug;
@devicesarray = join ( ":", $symmvol, $symmDevWWN);
print "@devicesarray\n" if $debug;
#$device{$symmSerial}[DEVICES]{symmvol}{$symmvol}{devname} =
$symmvol;
#$device{$symmSerial}[DEVICES]{symmvol}{$symmvol}{WWN} =
$symmDevWWN;
#$device{$symmSerial}{symmvol}{$symmvol}{devname} = $symmvol;
$device{$symmSerial}{symmvol}{$symmvol}{WWN} = $symmDevWWN;
}

if ( /^\s+Device Block Size\s+:\s+(\w+)/ ) {
$DeviceBlockSize = $1;
$device{$symmSerial}{symmvol}{$symmvol}{DBS} = $DeviceBlockSize;
print "$DeviceBlockSize\n" if $debug;
}

if ( /^\s+Device Configuration\s+:\s+(\S+\s\S+)/ ) {
$DeviceConfiguration = $1;
$device{$symmSerial}{symmvol}{$symmvol}{devconfig} =
$DeviceConfiguration;
#print "$DeviceConfiguration\n";
}

if ( /^\s+Device Status\s+:\s+(\w+\s+\S+)/ ) {
$DeviceStatus = $1;
$device{$symmSerial}{symmvol}{$symmvol}{devicestatus} =
$DeviceStatus;
}


}

for my $key (sort keys %symmHash ) {
my $value = $symmHash{$key};
print "$key => $value\n" if $debug;
}

$data{$symmSerial}{DEVICES} = [ @symmDevices ];
$symmHash_ref{DEVICES}{"$symmvol"} = {"$symmDevWWN"};
print Dumper \%data if $debug;
#print $device{$symmSerial}{'symmvol'}{'0000'}{'devicestatus'}, "\n";
print Dumper \%device;


---- end script ---- ### there is alot of extra information in this script,
I am just playing around to get a more better feeling on perl.

---- data file ----
Symmetrix ID: 000183701827

Device Physical Name : /dev/vx/rdmp/c5t0d0s2

Device Symmetrix Name : 0000 (VCM)
Device Serial ID : 27000000
Symmetrix ID : 000183701827
WWN : 6006048000018370182756434D303030

Attached BCV Device : N/A

Attached VDEV TGT Device : N/A

Vendor ID : EMC
Product ID : SYMMETRIX
Product Revision : 5267

Device Emulation Type : FBA
Device Defined Label Type: N/A
Device Defined Label : N/A
Device Sub System Id : 0x0140

Device Block Size : 512

Device Capacity
{
Cylinders : 16
Tracks : 240
512-byte Blocks : 15360
MegaBytes : 8
KiloBytes : 7680
}

Device Configuration : 2-Way Mir

Device is WORM Enabled : No
Device is WORM Protected : No

SCSI-3 Persistent Reserve: Disabled

Dynamic Spare Invoked : No

Dynamic RDF Capability : None

Device Service State : Normal

Device Status : Write Disabled (WD)
Device SA Status : Write Disabled (WD)

Front Director Paths (15):
{
----------------------------------------------------------------------
POWERPATH DIRECTOR PORT LUN
--------- ---------- ---- -------- ---------
PdevName Type Type Num Sts VBUS TID SYMM
Host
----------------------------------------------------------------------
/dev/vx/rdmp/c5t0d0s2 N/A FA 05A:0 WD 000 00 000
000
/dev/rdsk/c4t0d0s2 N/A FA 05A:0 WD 000 00 000
000
/dev/rdsk/c5t0d0s2 N/A FA 06B:0 WD 000 00 000
000
Not Visible N/A FA 03A:0 WD 000 00 000
N/A
Not Visible N/A FA 04A:0 WD 000 00 000
N/A
Not Visible N/A FA 06A:0 WD 000 00 000
N/A
Not Visible N/A FA 12A:0 WD 000 00 000
N/A
Not Visible N/A FA 13A:0 WD 000 00 000
N/A
Not Visible N/A FA 14A:0 WD 000 00 000
N/A
Not Visible N/A FA 03B:0 WD 000 00 000
N/A
Not Visible N/A FA 04B:0 WD 000 00 000
N/A
Not Visible N/A FA 05B:0 WD 000 00 000
N/A
Not Visible N/A FA 12B:0 WD 000 00 000
N/A
Not Visible N/A FA 13B:0 WD 000 00 000
N/A
Not Visible N/A FA 14B:0 WD 000 00 000
N/A
}

Mirror Set Type : [Data,Data,N/A,N/A]

Mirror Set DA Status : [RW,RW,N/A,N/A]

Mirror Set Inv. Tracks : [0,0,0,0]

Back End Disk Director Information
{
Hyper Type : Data
Hyper Status : Ready (RW)
Disk [Director, Interface, TID] : [01A, C, 0]
Disk Director Volume Number : 5
Hyper Number : 5
Disk Capacity : 47702m
Disk Group Number : 0

Hyper Type : Data
Hyper Status : Ready (RW)
Disk [Director, Interface, TID] : [16B, C, 2]
Disk Director Volume Number : 12
Hyper Number : 4
Disk Capacity : 47702m
Disk Group Number : 0
}


Device Physical Name : Not Visible
Device Symmetrix Name : 0001
Device Serial ID : N/A
Symmetrix ID : 000183701827
WWN : 60060480000183701827515552303030

Attached BCV Device : N/A

Attached VDEV TGT Device : N/A

Vendor ID : EMC
Product ID : SYMMETRIX
Product Revision : 5267

Device Emulation Type : FBA
Device Defined Label Type: N/A
Device Defined Label : N/A
Device Sub System Id : 0x0140

Device Block Size : 512

Device Capacity
{
Cylinders : 214
Tracks : 3210
512-byte Blocks : 205440
MegaBytes : 100
KiloBytes : 102720
}

Device Configuration : RAID-S (3+1)

Device is WORM Enabled : No
Device is WORM Protected : No

SCSI-3 Persistent Reserve: Disabled

Dynamic Spare Invoked : No

Dynamic RDF Capability : None

Device Service State : Normal

Device Status : Ready (RW)
Device SA Status : Ready (RW)

Front Director Paths (4):
{
----------------------------------------------------------------------
--------- ---------- ---- -------- ---------
PdevName Type Type Num Sts VBUS TID SYMM
Host
----------------------------------------------------------------------
Not Visible N/A FA 03A:0 RW 000 00 001
N/A
Not Visible N/A FA 04A:0 RW 000 00 001
N/A
Not Visible N/A FA 04B:0 RW 000 00 001
N/A
Not Visible N/A FA 14B:0 RW 000 00 001
N/A
}

Mirror Set Type : [RAID-S Data,RAID-S Parity,N/A,N/A]

Mirror Set DA Status : [RW,RW,N/A,N/A]

Mirror Set Inv. Tracks : [0,0,0,0]

Back End Disk Director Information
{
Hyper Type : RAID-S Data
Hyper Status : Ready (RW)
Disk [Director, Interface, TID] : [01A, C, 2]
RAID-S group Number : 804B
Disk Director Volume Number : 13
Hyper Number : 4
Disk Capacity : 47702m
Disk Group Number : 0

Hyper Type : RAID-S Parity
Hyper Status : Ready (RW)
Disk [Director, Interface, TID] : [10A, C, 2]
RAID-S group Number : 804B
Disk Director Volume Number : 12
Hyper Number : 4
Disk Capacity : 47702m
Disk Group Number : 0
}
-- end data --- ### This is only partial file... too big to send

As you can see - this information is for every Device Symmetrix Name.


__END__

Bryan Jones



.