mirror of
https://github.com/Studio-Saelix/sencho.git
synced 2026-09-08 08:26:57 +00:00
c613010199
* feat: account for VM memory ballooning in host memory reporting Extend hostMemory.ts with a readBalloonedMemory() function that parses the Balloon: field from /proc/meminfo, following the same fail-open pattern as the ZFS ARC integration. When a nonzero balloon is detected, effective memory fields (effectiveUsed, effectiveFree, effectiveUsagePercent) are computed and exposed through /api/system/stats and /api/fleet/overview. All consumers that derive meaning from host memory now prefer effective values when present: the dashboard gauge, Fleet card RAM bar, mobile views, health verdict, health status bar stat tile, and host RAM alerts. Backward compatible: missing /proc/meminfo or absent Balloon: line preserves exact current behavior. Old remote nodes without the new fields continue rendering normally. * refactor: extract shared helpers for balloon memory wiring Extract readCandidateFile() and logSelectedPath() in hostMemory.ts to deduplicate ARC and balloon file-read logic. Add memoryToWire() to centralize the optional-field spread used by /api/system/stats and /api/fleet/overview. Add getNodeMemUsed()/getNodeMemTotal() helpers in nodeUtils.ts for frontend byte-text consumers. * fix: make desktop fleet masthead aggregate balloon-aware The desktop fleet overview's memory aggregate in useFleetOverview.ts still summed raw memory.used, while the mobile fleet aggregate and per-node cards already used effective values. Update to use getNodeMemUsed/getNodeMemTotal helpers. * fix: revert balloon adjustment from alerting and health decisions Ballooned memory is host-reclaimed (unlike ZFS ARC, which the guest can reclaim on demand). The guest cannot get ballooned pages back until the hypervisor deflates them, so treating ballooned memory as available for alerting or health can mask real memory pressure. Keep balloon parsing, wire fields, and the dashboard context line as informational-only. The memory gauge, health verdict, and host RAM alerts now use the standard ARC-adjusted working-set percentage regardless of balloon. Updated configuration.mdx and dashboard.mdx to document that balloon data is informational and does not influence alerting.
30 lines
969 B
TypeScript
30 lines
969 B
TypeScript
import type { FleetNode } from './types';
|
|
|
|
export function getNodeCpu(node: FleetNode): number {
|
|
return node.systemStats ? parseFloat(node.systemStats.cpu.usage) : 0;
|
|
}
|
|
|
|
export function getNodeMem(node: FleetNode): number {
|
|
if (!node.systemStats) return 0;
|
|
const eff = node.systemStats.memory.effectiveUsagePercent;
|
|
return parseFloat(eff ?? node.systemStats.memory.usagePercent);
|
|
}
|
|
|
|
export function getNodeMemUsed(node: FleetNode): number {
|
|
const mem = node.systemStats?.memory;
|
|
return mem?.effectiveUsed ?? mem?.used ?? 0;
|
|
}
|
|
|
|
export function getNodeMemTotal(node: FleetNode): number {
|
|
const mem = node.systemStats?.memory;
|
|
return mem?.effectiveTotal ?? mem?.total ?? 0;
|
|
}
|
|
|
|
export function getNodeDisk(node: FleetNode): number {
|
|
return node.systemStats?.disk ? parseFloat(node.systemStats.disk.usagePercent) : 0;
|
|
}
|
|
|
|
export function isCritical(node: FleetNode): boolean {
|
|
return getNodeCpu(node) > 90 || getNodeDisk(node) > 90;
|
|
}
|