projects
/
scpubgit/System-Introspector.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
blame
|
history
|
raw
|
HEAD
use reusable I/O utils and better error handling
[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;
26
27
__END__
28
29
=head1 NAME
30
31
System::Introspector::DiskUsage - Gather disk space usage data
32
33
=head1 DESCRIPTION
34
35
Uses C<df> to get data about current disk usage.
36
37
=head1 SEE ALSO
38
39
=over
40
41
=item L<System::Introspector>
42
43
=back
44
45
=cut
46