Add system info to SystemInfo

Provide the kernel, machine, CPU Model, hostname, and Node.js version
fields to SystemInfo and display them in the Web UI.  These were added
as metrics exposed to prometheus in b46efeb.
This commit is contained in:
Hornwitser committed 2024-01-16 21:27:02 +01:00
1 parent 4e36fa1b4e
commit de47989527
6 files changed
+63 -3

No files matched your search

@@ -192,6 +192,7 @@ export default function HostsPage() {
const [systems] = useSystems();
const [showRatios, setShowRatios] = useState(true);
const [showNumbers, setShowNumbers] = useState(false);
const [showCpuModel, setShowCpuModel] = useState(false);
return <PageLayout nav={[{ name: "Hosts" }]}>
<PageHeader
@@ -207,6 +208,13 @@ export default function HostsPage() {
defaultSortOrder: "ascend",
sorter: (a, b) => strcmp(a.name, b.name),
},
{
title: "CPU Model",
dataIndex: "cpuModel",
sorter: (a, b) => strcmp(systems.get(a.id)?.cpuModel ?? "", systems.get(b.id)?.cpuModel ?? ""),
render: (_, host) => systems.get(host.id)?.cpuModel,
hidden: !showCpuModel,
},
{
title: "CPU%",
sorter: (a, b) => (systems.get(a.id)?.cpuRatio ?? 0) - (systems.get(b.id)?.cpuRatio ?? 0),
@@ -290,6 +298,10 @@ export default function HostsPage() {
Show metric numbers:
<Switch checked={showNumbers} onChange={checked => { setShowNumbers(checked); }} />
</label>
<label style={{ width: "14em", display: "flex", justifyContent: "space-between", marginRight: 16 }}>
Show CPU model:
<Switch checked={showCpuModel} onChange={checked => { setShowCpuModel(checked); }} />
</label>
</Flex>
<PluginExtra component="HostsPage" />
</PageLayout>;