2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-20 13:26:02 +00:00

32_SYSSTAT.pm: windows uptime fix

git-svn-id: https://svn.fhem.de/fhem/trunk@23971 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
justme-1968 2021-03-14 16:33:09 +00:00
parent f2f3079405
commit 75e5a345c0

View File

@ -483,7 +483,7 @@ SYSSTAT_Parse($$$)
my $hours = $uptime % 24;
my $days = int($uptime / 24);
$uptime = sprintf( "%d days, %d:%.2d", $days, $hours, $minutes);
$uptime = sprintf( "%d days, %d:%.2d:%.2d", $days, $hours, $minutes, $seconds);
}
if( $hash->{BlockingResult} ) {
@ -630,6 +630,7 @@ SYSSTAT_InitSNMP($)
-community => AttrVal($name,"snmpCommunity","public"),
-port => 161,
-version => AttrVal($name,"snmpVersion",1),
-translate => [ -timeticks => 0x0 ],
);
if( $error ) {
Log3 $name, 2, "$name: $error";
@ -1343,20 +1344,8 @@ SYSSTAT_getUptimeSNMP($)
my $response = SYSSTAT_readOIDs($hash,\@snmpoids);
my $uptime = $response->{'.1.3.6.1.2.1.25.1.1.0'};
if( $uptime && $uptime =~ m/(\d+)\s\D+,\s(\d+):(\d+):(\d+)/ ) {
my $days = $1?$1:0;
my $hours = $2;
my $minutes = $3;
my $seconds = $4;
$uptime = $days * 24;
$uptime += $hours;
$uptime *= 60;
$uptime += $minutes;
$uptime *= 60;
$uptime += $seconds;
SYSSTAT_Parse($hash, 'cat /proc/uptime', $uptime);
if( defined($uptime) ) {
SYSSTAT_Parse($hash, 'cat /proc/uptime', $uptime/100);
return;
}