Report uptime from the agents, and stop the Integrations page overflowing a phone
Linux agent 8 and Windows agent 7 say how long the machine has been up; the server stores it (migration 0086) and shows it as Up for in the status strip (left out while offline) and Uptime on the server page. The Integrations header wraps and its button no longer squeezes, and .table-responsive is positioned so hidden text in scrolled-off columns cannot widen the page. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
d88a24b33a
commit
41fbbf3467
18 files changed
+9161
-10
No files matched your search
@@ -36,7 +36,7 @@ $ErrorActionPreference = 'Stop'
|
||||
# 3 = can replace itself with the newer script when an administrator has switched that on in Homelab Manager
|
||||
# 4 = also reports services that have failed, disk health, Storage Spaces pools and what the machine is (maker, model, serial)
|
||||
# 5 = also says what it could not collect and why, so Homelab Manager can say what to fix
|
||||
$script:AgentVersion = 6
|
||||
$script:AgentVersion = 7
|
||||
|
||||
$script:DefaultConfigPath = Join-Path $env:ProgramData 'HomelabManager\agent.json'
|
||||
|
||||
@@ -432,6 +432,10 @@ function Get-SystemInfo($Config = $null) {
|
||||
$load = ($cpus | Where-Object { $null -ne $_.LoadPercentage } | Measure-Object -Property LoadPercentage -Average).Average
|
||||
$cores = ($cpus | Measure-Object -Property NumberOfLogicalProcessors -Sum).Sum
|
||||
|
||||
# How long it has been up, in seconds (null if Windows does not say when it started).
|
||||
$uptime = $null
|
||||
try { if ($os.LastBootUpTime) { $uptime = [int64][math]::Floor(((Get-Date) - $os.LastBootUpTime).TotalSeconds); if ($uptime -lt 1) { $uptime = $null } } } catch { }
|
||||
|
||||
$disks = @()
|
||||
foreach ($d in @(Get-CimInstance -ClassName Win32_LogicalDisk -Filter 'DriveType=3')) {
|
||||
if (-not $d.Size) { continue } # an unformatted or unavailable volume
|
||||
@@ -468,6 +472,7 @@ function Get-SystemInfo($Config = $null) {
|
||||
ip_addresses = @($ips)
|
||||
cpu = [ordered]@{ model = [string]($cpus[0].Name).Trim(); cores = [int]$cores; load_percent = $(if ($null -ne $load) { [math]::Round([double]$load, 1) } else { $null }) }
|
||||
memory = [ordered]@{ total_bytes = $totalBytes; used_bytes = ($totalBytes - $freeBytes) }
|
||||
uptime_seconds = $uptime
|
||||
disks = @($disks)
|
||||
listening_ports = @(Get-ListeningPorts)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user