Compare commits

...

3 Commits

Author SHA1 Message Date
henrygd
82bd953941 add arch 2025-12-16 18:33:32 -05:00
henrygd
996444abeb update 2025-12-16 17:45:26 -05:00
henrygd
aef4baff5e rm index 2025-12-15 18:59:25 -05:00
5 changed files with 40 additions and 14 deletions

View File

@@ -6,6 +6,7 @@ import (
"fmt"
"log/slog"
"os"
"runtime"
"strconv"
"strings"
"time"
@@ -41,6 +42,11 @@ func (a *Agent) refreshStaticInfo() {
}
a.systemDetails.Hostname, _ = os.Hostname()
if arch, err := host.KernelArch(); err == nil {
a.systemDetails.Arch = arch
} else {
a.systemDetails.Arch = runtime.GOARCH
}
platform, _, version, _ := host.PlatformInformation()

View File

@@ -158,10 +158,11 @@ type Details struct {
Hostname string `cbor:"0,keyasint"`
Kernel string `cbor:"1,keyasint,omitempty"`
Cores int `cbor:"2,keyasint"`
Threads int `cbor:"3,keyasint,omitempty"`
Threads int `cbor:"3,keyasint"`
CpuModel string `cbor:"4,keyasint"`
Os Os `cbor:"5,keyasint"`
OsName string `cbor:"6,keyasint"`
Arch string `cbor:"7,keyasint"`
Podman bool `cbor:"8,keyasint,omitempty"`
MemoryTotal uint64 `cbor:"9,keyasint"`
}

View File

@@ -236,6 +236,7 @@ func createStaticInfoRecord(app core.App, data *system.Details, systemId string)
record.Set("cpu", data.CpuModel)
record.Set("os", data.Os)
record.Set("os_name", data.OsName)
record.Set("arch", data.Arch)
record.Set("memory", data.MemoryTotal)
record.Set("podman", data.Podman)
return app.SaveNoValidate(record)
@@ -388,7 +389,8 @@ func (sys *System) fetchStringFromAgentViaSSH(action common.WebSocketAction, req
if err := session.Shell(); err != nil {
return false, err
}
req := common.HubRequest[any]{Action: action, Data: requestData}
reqDataBytes, _ := cbor.Marshal(requestData)
req := common.HubRequest[cbor.RawMessage]{Action: action, Data: reqDataBytes}
_ = cbor.NewEncoder(stdin).Encode(req)
_ = stdin.Close()
var resp common.AgentResponse
@@ -452,7 +454,8 @@ func (sys *System) FetchSystemdInfoFromAgent(serviceName string) (systemd.Servic
return false, err
}
req := common.HubRequest[any]{Action: common.GetSystemdInfo, Data: common.SystemdInfoRequest{ServiceName: serviceName}}
reqDataBytes, _ := cbor.Marshal(common.SystemdInfoRequest{ServiceName: serviceName})
req := common.HubRequest[cbor.RawMessage]{Action: common.GetSystemdInfo, Data: reqDataBytes}
if err := cbor.NewEncoder(stdin).Encode(req); err != nil {
return false, err
}
@@ -500,7 +503,8 @@ func (sys *System) fetchDataViaSSH(options common.DataRequestOptions) (*system.C
*sys.data = system.CombinedData{}
if sys.agentVersion.GTE(beszel.MinVersionAgentResponse) && stdinErr == nil {
req := common.HubRequest[any]{Action: common.GetData, Data: options}
reqDataBytes, _ := cbor.Marshal(options)
req := common.HubRequest[cbor.RawMessage]{Action: common.GetData, Data: reqDataBytes}
_ = cbor.NewEncoder(stdin).Encode(req)
_ = stdin.Close()

View File

@@ -1539,6 +1539,20 @@ func init() {
"system": false,
"type": "text"
},
{
"autogeneratePattern": "",
"hidden": false,
"id": "text4161937994",
"max": 0,
"min": 0,
"name": "arch",
"pattern": "",
"presentable": false,
"primaryKey": false,
"required": false,
"system": false,
"type": "text"
},
{
"hidden": false,
"id": "number4245036687",
@@ -1596,9 +1610,7 @@ func init() {
}
],
"id": "pbc_3116237454",
"indexes": [
"CREATE UNIQUE INDEX ` + "`" + `idx_5d1egp3jVU` + "`" + ` ON ` + "`" + `system_details` + "`" + ` (` + "`" + `system` + "`" + `)"
],
"indexes": [],
"listRule": "@request.auth.id != \"\" && system.users.id ?= @request.auth.id",
"name": "system_details",
"system": false,

View File

@@ -7,6 +7,7 @@ import { cn, formatBytes, getHostDisplayValue, secondsToString, toFixedFloat } f
import { Separator } from "@/components/ui/separator"
import {
AppleIcon,
BinaryIcon,
ChevronRightSquareIcon,
ClockArrowUp,
CpuIcon,
@@ -46,7 +47,7 @@ export default function InfoBar({
}
pb.collection<SystemDetailsRecord>("system_details")
.getOne(system.id, {
fields: "hostname,kernel,cores,threads,cpu,os,os_name,memory,podman",
fields: "hostname,kernel,cores,threads,cpu,os,os_name,arch,memory,podman",
headers: {
"Cache-Control": "public, max-age=60",
},
@@ -72,6 +73,7 @@ export default function InfoBar({
const cpuModel = details?.cpu ?? system.info.m
const os = details?.os ?? system.info.os ?? Os.Linux
const osName = details?.os_name
const arch = details?.arch
const memory = details?.memory
const osInfo = {
@@ -116,6 +118,7 @@ export default function InfoBar({
},
{ value: uptime, Icon: ClockArrowUp, label: t`Uptime`, hide: !system.info.u },
osInfo[os],
{ value: arch, Icon: BinaryIcon, hide: !arch },
] as {
value: string | number | undefined
label?: string
@@ -123,6 +126,12 @@ export default function InfoBar({
hide?: boolean
}[]
info.push({
value: `${cpuModel} (${cores}c${threads ? `/${threads}t` : ""})`,
Icon: CpuIcon,
hide: !cpuModel,
})
if (memory) {
const memValue = formatBytes(memory, false, undefined, false)
info.push({
@@ -133,12 +142,6 @@ export default function InfoBar({
})
}
info.push({
value: `${cpuModel} (${cores}c${threads ? `/${threads}t` : ""})`,
Icon: CpuIcon,
hide: !cpuModel,
})
return info
}, [system, details, t])