From: Robert 'phaylon' Sedlacek Date: Wed, 9 May 2012 01:34:35 +0000 (+0000) Subject: DiskUsage probe for getting df output X-Git-Tag: v0.001_001~111 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=6580617b2d2456f58fd2ac91b97beb762850d9af;p=scpubgit%2FSystem-Introspector.git DiskUsage probe for getting df output --- diff --git a/lib/System/Introspector/DiskUsage.pm b/lib/System/Introspector/DiskUsage.pm new file mode 100644 index 0000000..061a6da --- /dev/null +++ b/lib/System/Introspector/DiskUsage.pm @@ -0,0 +1,25 @@ +package System::Introspector::DiskUsage; +use Moo; + +sub gather { + my ($self) = @_; + my @lines = `df -aP`; + shift @lines; # header + chomp @lines; + my @rows; + for my $line (@lines) { + my %row; + @row{qw( + filesystem + blocks_1024 + used + available + capacity + mount_point + )} = split m{\s+}, $line; + push @rows, \%row; + } + return \@rows; +} + +1;