061a6daefa80de2d91371a3edae540c50cd18788
[scpubgit/System-Introspector.git] / lib / System / Introspector / DiskUsage.pm
1 package System::Introspector::DiskUsage;
2 use Moo;
3
4 sub gather {
5     my ($self) = @_;
6     my @lines = `df -aP`;
7     shift @lines; # header
8     chomp @lines;
9     my @rows;
10     for my $line (@lines) {
11         my %row;
12         @row{qw(
13             filesystem
14             blocks_1024
15             used
16             available
17             capacity
18             mount_point
19         )} = split m{\s+}, $line;
20         push @rows, \%row;
21     }
22     return \@rows;
23 }
24
25 1;