From c402bf59907717d92bc53218d253c67398096d2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B8=A9=E6=B5=B7=E6=B3=A2?= Date: Wed, 6 Dec 2023 19:05:59 +0800 Subject: [PATCH] =?UTF-8?q?OS=E6=B2=A1=E6=9C=89=E6=89=A7=E8=A1=8CUpTime?= =?UTF-8?q?=E7=9A=84=E9=87=87=E9=9B=86=EF=BC=8C=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/remote/cmdbcollect/lib/OSGatherLinux.pm | 2 ++ plugins/remote/cmdbcollect/lib/OSGatherWindows.pm | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/plugins/remote/cmdbcollect/lib/OSGatherLinux.pm b/plugins/remote/cmdbcollect/lib/OSGatherLinux.pm index cf8ce028..bc830311 100644 --- a/plugins/remote/cmdbcollect/lib/OSGatherLinux.pm +++ b/plugins/remote/cmdbcollect/lib/OSGatherLinux.pm @@ -773,6 +773,7 @@ sub collectOsInfo { my $osInfo = {}; if ( $self->{justBaseInfo} == 0 ) { + $self->getUpTime($osInfo); $self->getMiscInfo($osInfo); $self->getOsVersion($osInfo); $self->getVendorInfo($osInfo); @@ -789,6 +790,7 @@ sub collectOsInfo { $self->getUserInfo($osInfo); } else { + $self->getUpTime($osInfo); $self->getMemInfo($osInfo); $self->getIpAddrs($osInfo); } diff --git a/plugins/remote/cmdbcollect/lib/OSGatherWindows.pm b/plugins/remote/cmdbcollect/lib/OSGatherWindows.pm index d3f9cd9d..0bcda429 100644 --- a/plugins/remote/cmdbcollect/lib/OSGatherWindows.pm +++ b/plugins/remote/cmdbcollect/lib/OSGatherWindows.pm @@ -15,7 +15,7 @@ use Win32::API; use OSGatherBase; our @ISA = qw(OSGatherBase); -sub getUptime { +sub getUpTime { my ( $self, $osInfo ) = @_; my $uptimeSeconds; @@ -451,6 +451,7 @@ sub collectOsInfo { my $osInfo = {}; if ( $self->{justBaseInfo} == 0 ) { + $self->getUpTime($osInfo); $self->getMiscInfo($osInfo); $self->getDNSInfo($osInfo); $self->getNTPInfo($osInfo); @@ -464,6 +465,7 @@ sub collectOsInfo { $self->getDiskInfo($osInfo); } else { + $self->getUpTime($osInfo); $self->getSystemInfo($osInfo); $self->getIpAddrs($osInfo); } -- Gitee