diff --git a/fhem/CHANGED b/fhem/CHANGED index 955f5bcf3..5df591ea2 100644 --- a/fhem/CHANGED +++ b/fhem/CHANGED @@ -1,5 +1,6 @@ # Add changes at the top of the list. Keep it in ASCII - SVN + - feature: SYSSTAT: allow (remote) monitoring system uptime - feature: new module 98_openweathermap.pm added (betateilchen) - feature: WeatherAsHtmlH() added to 59_Weather.pm (Boris) - feature: new module I2C_BMP180 for reading I2C digital pressure sensor BMP180 diff --git a/fhem/FHEM/32_SYSSTAT.pm b/fhem/FHEM/32_SYSSTAT.pm index 9b1298eef..48e98c7ea 100644 --- a/fhem/FHEM/32_SYSSTAT.pm +++ b/fhem/FHEM/32_SYSSTAT.pm @@ -17,7 +17,7 @@ SYSSTAT_Initialize($) $hash->{UndefFn} = "SYSSTAT_Undefine"; $hash->{GetFn} = "SYSSTAT_Get"; $hash->{AttrFn} = "SYSSTAT_Attr"; - $hash->{AttrList} = "filesystems raspberrycpufreq:1 raspberrytemperature:0,1,2 showpercent:1 useregex:1 ssh_user loglevel:0,1,2,3,4,5,6 ". + $hash->{AttrList} = "filesystems raspberrycpufreq:1 raspberrytemperature:0,1,2 showpercent:1 uptime:1 useregex:1 ssh_user loglevel:0,1,2,3,4,5,6 ". $readingFnAttributes; } @@ -223,6 +223,12 @@ SYSSTAT_GetUpdate($) readingsBulkUpdate($hash,"cpufreq",$freq); } + if( AttrVal($name, "uptime", "0") > 0 ) { + my $uptime = SYSSTAT_getUptime($hash); + readingsBulkUpdate($hash,"uptime",$uptime); + } + + readingsEndUpdate($hash,defined($hash->{LOCAL} ? 0 : 1)); } @@ -341,6 +347,18 @@ SYSSTAT_getPiFreq( $ ) return $freq / 1000; } +sub +SYSSTAT_getUptime( $ ) +{ + my ($hash) = @_; + + my $uptime = SYSSTAT_readCmd($hash,"uptime",0); + + $uptime = $1 if( $uptime =~ m/up\s+([\d:]*)/ ); + + return $uptime; +} + 1; @@ -434,6 +452,8 @@ SYSSTAT_getPiFreq( $ )
  • raspberrycpufreq
    If set and > 0 the raspberry pi on chip termal sensor is read.
    If set to 2 a geometric average over the last 4 values is created.
  • +
  • uptime
    + If set and > 0 the system uptime is read.
  • useregex
    If set the entries of the filesystems list are treated as regex.
  • ssh_user