mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-05-07 22:29:19 +00:00
- ensure only one timer is running
- check and enforce allowed values in for showpercent and useregex - clarification in documentation git-svn-id: https://svn.fhem.de/fhem/trunk/fhem@2663 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
c39e392ae8
commit
d74f286085
@ -13,7 +13,7 @@ SYSSTAT_Initialize($)
|
|||||||
$hash->{DefFn} = "SYSSTAT_Define";
|
$hash->{DefFn} = "SYSSTAT_Define";
|
||||||
$hash->{UndefFn} = "SYSSTAT_Undefine";
|
$hash->{UndefFn} = "SYSSTAT_Undefine";
|
||||||
$hash->{AttrFn} = "SYSSTAT_Attr";
|
$hash->{AttrFn} = "SYSSTAT_Attr";
|
||||||
$hash->{AttrList} = "filesystems showpercent useregex 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -55,13 +55,14 @@ sub
|
|||||||
SYSSTAT_Attr($$$)
|
SYSSTAT_Attr($$$)
|
||||||
{
|
{
|
||||||
my ($cmd, $name, $attrName, $attrVal) = @_;
|
my ($cmd, $name, $attrName, $attrVal) = @_;
|
||||||
my $hash = $defs{$name};
|
|
||||||
|
|
||||||
$attrVal= "" unless defined($attrVal);
|
$attrVal= "" unless defined($attrVal);
|
||||||
$attrVal= "" if($cmd eq "useregex");
|
my $orig = $attrVal;
|
||||||
$attrVal= "" if($cmd eq "showpercent");
|
$attrVal= "1" if($attrName eq "useregex");
|
||||||
|
$attrVal= "1" if($attrName eq "showpercent");
|
||||||
|
|
||||||
if( $attrName eq "filesystems") {
|
if( $attrName eq "filesystems") {
|
||||||
|
my $hash = $defs{$name};
|
||||||
my @filesystems = split(",",$attrVal);
|
my @filesystems = split(",",$attrVal);
|
||||||
@{$hash->{filesystems}} = @filesystems;
|
@{$hash->{filesystems}} = @filesystems;
|
||||||
|
|
||||||
@ -74,6 +75,13 @@ SYSSTAT_Attr($$$)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( $cmd eq "set" ) {
|
||||||
|
if( $orig ne $attrVal ) {
|
||||||
|
$attr{$name}{$attrName} = $attrVal;
|
||||||
|
return $attrName ." set to ". $attrVal;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,6 +91,7 @@ SYSSTAT_GetUpdate($)
|
|||||||
my ($hash) = @_;
|
my ($hash) = @_;
|
||||||
|
|
||||||
if(!$hash->{LOCAL}) {
|
if(!$hash->{LOCAL}) {
|
||||||
|
RemoveInternalTimer($hash);
|
||||||
InternalTimer(gettimeofday()+$hash->{INTERVAL}, "SYSSTAT_GetUpdate", $hash, 1);
|
InternalTimer(gettimeofday()+$hash->{INTERVAL}, "SYSSTAT_GetUpdate", $hash, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -153,7 +162,7 @@ SYSSTAT_GetUpdate($)
|
|||||||
|
|
||||||
Defines a SYSSTAT device.<br><br>
|
Defines a SYSSTAT device.<br><br>
|
||||||
|
|
||||||
The statistics are updated <interval> seconds. The default is 60.<br><br>
|
The statistics are updated <interval> seconds. The default and minimum is 60.<br><br>
|
||||||
|
|
||||||
Examples:
|
Examples:
|
||||||
<ul>
|
<ul>
|
||||||
@ -176,7 +185,7 @@ SYSSTAT_GetUpdate($)
|
|||||||
<a name="SYSSTAT_Attr"></a>
|
<a name="SYSSTAT_Attr"></a>
|
||||||
<b>Attributes</b>
|
<b>Attributes</b>
|
||||||
<li>filesystems<br>
|
<li>filesystems<br>
|
||||||
List of comma separated filesystems that should be monitored.<br>
|
List of comma separated filesystems (not mountpoints) that should be monitored.<br>
|
||||||
Examples:
|
Examples:
|
||||||
<ul>
|
<ul>
|
||||||
<code>attr sysstat filesystems /dev/md0,/dev/md2</code><br>
|
<code>attr sysstat filesystems /dev/md0,/dev/md2</code><br>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user