source: ocsinventory-agent/trunk/fuentes/lib/Ocsinventory/Agent/Backend/OS/Solaris/Storages.pm @ 468

Last change on this file since 468 was 468, checked in by mabarracus, 4 years ago

Copyt trusty code

File size: 2.3 KB
Line 
1package Ocsinventory::Agent::Backend::OS::Solaris::Storages;
2use strict;
3#use warning;
4
5#sd0      Soft Errors: 0 Hard Errors: 0 Transport Errors: 0
6#Vendor: HITACHI  Product: DK32EJ72NSUN72G  Revision: PQ08 Serial No: 43W14Z080040A34E
7#Size: 73.40GB <73400057856 bytes>
8#Media Error: 0 Device Not Ready: 0 No Device: 0 Recoverable: 0
9#Illegal Request: 0 Predictive Failure Analysis: 0
10
11# With -En :
12#c8t60060E80141A420000011A420000300Bd0 Soft Errors: 1 Hard Errors: 0 Transport Errors: 0
13#Vendor: HITACHI  Product: OPEN-V      -SUN Revision: 5009 Serial No: 
14#Size: 64.42GB <64424509440 bytes>
15#Media Error: 0 Device Not Ready: 0 No Device: 0 Recoverable: 0
16#Illegal Request: 1 Predictive Failure Analysis: 0
17
18
19sub check { can_run ("iostat") }
20
21sub run {
22  my $params = shift;
23  my $common = $params->{common};
24
25  my $manufacturer;
26  my $model;
27  my $description;
28  my $capacity;
29  my $name;
30  my $rev;
31  my $sn;
32  my $type;
33  my $flag_first_line;
34  my $rdisk_path;
35
36  foreach(`iostat -En`){
37#print;
38    if($flag_first_line){               
39      if(/^.*<(\S+)\s*bytes/){                         
40        $capacity = $1;
41        $capacity = $capacity/(1024*1024);
42#print $capacity."\n";
43      }
44      ## To be removed when FIRMWARE will be supported
45      if ($rev) {
46        $description .= ' ' if $description;
47        $description .= "FW:$rev";
48      }
49
50      $rdisk_path=`ls -l /dev/rdsk/${name}s2`;
51      if( $rdisk_path =~ /.*->.*scsi_vhci.*/ ) {
52        $type="MPxIO";
53      } 
54      elsif( $rdisk_path =~ /.*->.*fp@.*/ ) {
55        $type="FC";
56      }
57      elsif( $rdisk_path =~ /.*->.*scsi@.*/ ) {
58        $type="SCSI";
59      }
60      $common->addStorages({
61          NAME => $name,
62          MANUFACTURER => $manufacturer,
63          MODEL => $model,
64          DESCRIPTION => $description,
65          TYPE => $type,
66          FIRMWARE => $rev,
67          SERIALNUMBER => $sn,
68          DISKSIZE => $capacity
69          });
70
71      $manufacturer='';
72      $model='';
73      $description='';
74      $name='';
75      $rev='';
76      $sn='';
77      $type='';
78    } 
79    $flag_first_line = 0;       
80    if(/^(\S+)\s+Soft/){
81        $name = $1;
82    }
83    if(/^.*Product:\s*(\S+)/){
84      $model = $1;
85    }
86    if(/^.*Serial No:\s*(\S+)/){
87      $sn = $1;
88      ## To be removed when SERIALNUMBER will be supported
89      $description = "S/N:$sn";
90      ##
91    }
92    if(/^.*Revision:\s*(\S+)/){
93      $rev = $1;
94    }
95    if(/^Vendor:\s*(\S+)/){
96      $manufacturer = $1;
97      $flag_first_line = 1;
98    }
99
100  } 
101}
102
1031;
Note: See TracBrowser for help on using the repository browser.