sort mount points by device_name/moint_point
[scpubgit/System-Introspector.git] / lib / System / Introspector / DiskUsage.pm
CommitLineData
6580617b 1package System::Introspector::DiskUsage;
2use Moo;
3
ff3e98f6 4use System::Introspector::Util qw(
5 lines_from_command
6 transform_exceptions
7);
8
6580617b 9sub gather {
10 my ($self) = @_;
ff3e98f6 11 return transform_exceptions {
12 my @lines = lines_from_command ['df', '-aP'];
13 shift @lines; # header
14 my @rows;
15 for my $line (@lines) {
16 my %row;
17 @row{qw(
18 filesystem
19 blocks_1024
20 used
21 available
22 capacity
23 mount_point
24 )} = split m{\s+}, $line;
25 push @rows, \%row;
26 }
27 return { disk_usage => \@rows };
28 };
6580617b 29}
30
311;
535e84b6 32
33__END__
34
35=head1 NAME
36
37System::Introspector::DiskUsage - Gather disk space usage data
38
39=head1 DESCRIPTION
40
41Uses C<df> to get data about current disk usage.
42
43=head1 SEE ALSO
44
45=over
46
47=item L<System::Introspector>
48
49=back
50
51=cut
52