added get filesystems command
git-svn-id: https://svn.fhem.de/fhem/trunk@2664 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
@@ -12,6 +12,7 @@ SYSSTAT_Initialize($)
|
|||||||
|
|
||||||
$hash->{DefFn} = "SYSSTAT_Define";
|
$hash->{DefFn} = "SYSSTAT_Define";
|
||||||
$hash->{UndefFn} = "SYSSTAT_Undefine";
|
$hash->{UndefFn} = "SYSSTAT_Undefine";
|
||||||
|
$hash->{GetFn} = "SYSSTAT_Get";
|
||||||
$hash->{AttrFn} = "SYSSTAT_Attr";
|
$hash->{AttrFn} = "SYSSTAT_Attr";
|
||||||
$hash->{AttrList} = "filesystems showpercent:1 useregex:1 loglevel:0,1,2,3,4,5,6 ".
|
$hash->{AttrList} = "filesystems showpercent:1 useregex:1 loglevel:0,1,2,3,4,5,6 ".
|
||||||
$readingFnAttributes;
|
$readingFnAttributes;
|
||||||
@@ -51,6 +52,31 @@ SYSSTAT_Undefine($$)
|
|||||||
return undef;
|
return undef;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub
|
||||||
|
SYSSTAT_Get($@)
|
||||||
|
{
|
||||||
|
my ($hash, @a) = @_;
|
||||||
|
|
||||||
|
my $name = $a[0];
|
||||||
|
return "$name: get needs at least one parameter" if(@a < 2);
|
||||||
|
|
||||||
|
my $cmd= $a[1];
|
||||||
|
|
||||||
|
if($cmd eq "filesystems") {
|
||||||
|
|
||||||
|
my $sys = Sys::Statistics::Linux->new(diskusage => 1);
|
||||||
|
my $filesystems = $sys->get->{diskusage};
|
||||||
|
|
||||||
|
my $ret;
|
||||||
|
foreach my $filesystem (keys %$filesystems ) {
|
||||||
|
$ret .= $filesystem ." <= ". $filesystems->{$filesystem}->{mountpoint} ."\n";
|
||||||
|
}
|
||||||
|
return $ret;
|
||||||
|
} else {
|
||||||
|
return "Unknown argument $cmd, choose one of filesystems";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
sub
|
sub
|
||||||
SYSSTAT_Attr($$$)
|
SYSSTAT_Attr($$$)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user