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

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

Copyt trusty code

File size: 1.6 KB
Line 
1package Ocsinventory::Agent::Backend::OS::Solaris::Drives;
2
3#Filesystem            kbytes    used   avail capacity  Mounted on
4#/dev/vx/dsk/bootdg/rootvol 16525754 5423501 10936996    34%    /
5#/devices                   0       0       0     0%    /devices
6#ctfs                       0       0       0     0%    /system/contract
7#proc                       0       0       0     0%    /proc
8#mnttab                     0       0       0     0%    /etc/mnttab
9
10
11use strict;
12sub check { can_run ("df") }
13
14sub run {
15  my $params = shift;
16  my $common = $params->{common};
17
18  my $free;
19  my $filesystem;
20  my $total;
21  my $type;
22  my $volumn; 
23
24#Looking for mount points and disk space
25  for(`df -k`){
26    if (/^Filesystem\s*/){next};
27    # on Solaris 10 /devices is an extra mount which we like to exclude
28    if (/^\/devices/){next};
29    # on Solaris 10 /platform/.../libc_psr_hwcap1.so.1 is an extra mount which we like to exclude
30    if (/^\/platform/){next};
31    # exclude cdrom mount point
32    if (/^\/.*\/cdrom/){next};
33
34    if (!(/^\/.*/) && !(/^swap.*/)){next};
35
36    if(/^(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\n/){     
37      $filesystem = $1;
38      $total = sprintf("%i",($2/1024)); 
39      $free = sprintf("%i",($4/1024));
40      $volumn = $6;
41
42      if($filesystem =~ /^\/dev\/\S*/){ 
43        chomp($type=`fstyp $filesystem`);
44        $type = '' if $type =~ /cannot stat/;
45      }
46      else {$type="";}   
47#print "FILESYS ".$filesystem." FILETYP ".$type." TOTAL ".$total." FREE ".$free." VOLUMN ".$volumn."\n";
48      $common->addDrive({
49          FREE => $free,
50          FILESYSTEM => $filesystem,
51          TOTAL => $total,
52          TYPE => $type,
53          VOLUMN => $volumn
54          })
55
56    }
57
58
59  }
60}
61
621;
Note: See TracBrowser for help on using the repository browser.