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

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

Copyt trusty code

File size: 769 bytes
Line 
1package Ocsinventory::Agent::Backend::OS::BSD::Drives;
2
3use strict;
4
5sub run {
6  my $params = shift;
7  my $common = $params->{common};
8
9  my $free;
10  my $filesystem;
11  my $total;
12  my $type;
13  my $volumn;
14
15
16  for my $t ("ffs","ufs") {
17# OpenBSD has no -m option so use -k to obtain results in kilobytes
18    for(`df -P -t $t -k`){
19      if(/^(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\S+)\n/){
20          $volumn = $1;
21          $filesystem = $t;
22          $total = sprintf("%i",$2/1024);
23          $free = sprintf("%i",$4/1024);
24          $type = $6;
25 
26        $common->addDrive({
27            FREE => $free,
28            FILESYSTEM => $filesystem,
29            TOTAL => $total,
30            TYPE => $type,
31            VOLUMN => $volumn
32          });
33      }
34    }
35  }
36}
371;
Note: See TracBrowser for help on using the repository browser.