Skip to content

Commit ad3ec32

Browse files
Fumunchuclaude
andcommitted
Use GiB for RAM/disk values to match free -h / df -h
32 GiB of RAM was displaying as "33G" because values were divided by 1e9 (decimal GB). Binary GiB is what users compare against (mathoudebine#449). Applied to local values and the remote-host page derivations. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 21e37f1 commit ad3ec32

2 files changed

Lines changed: 12 additions & 12 deletions

File tree

apps/common.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -200,11 +200,11 @@ def local_values():
200200
"nvme_temp": _nvme_temp(),
201201
"cpu_pct": psutil.cpu_percent(),
202202
"ram_pct": vm.percent,
203-
"ram_used_g": vm.used / 1e9,
204-
"ram_total_g": vm.total / 1e9,
203+
"ram_used_g": vm.used / 2**30, # GiB, matching free -h / df -h (#449)
204+
"ram_total_g": vm.total / 2**30,
205205
"disk_pct": du.percent,
206-
"disk_used_g": du.used / 1e9,
207-
"disk_total_g": du.total / 1e9,
206+
"disk_used_g": du.used / 2**30,
207+
"disk_total_g": du.total / 2**30,
208208
"temp": host_temp(),
209209
"load1": os.getloadavg()[0],
210210
"uptime": fmt_uptime(),

pages.yaml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -123,11 +123,11 @@ pages:
123123
net_up: sum(rate(node_network_transmit_bytes_total{instance="pve2.local:9100",device=~"en.*|eth.*|nic.*"}[2m]))
124124
derived:
125125
ram_pct: "100*(1-ram_a/ram_t)"
126-
ram_used_g: "(ram_t-ram_a)/1e9"
127-
ram_total_g: "ram_t/1e9"
126+
ram_used_g: "(ram_t-ram_a)/2**30"
127+
ram_total_g: "ram_t/2**30"
128128
disk_pct: "100*(1-disk_a/disk_t)"
129-
disk_used_g: "(disk_t-disk_a)/1e9"
130-
disk_total_g: "disk_t/1e9"
129+
disk_used_g: "(disk_t-disk_a)/2**30"
130+
disk_total_g: "disk_t/2**30"
131131
uptime: "str(int(up_s//86400))+'d '+str(int(up_s%86400//3600))+'h'"
132132
net_down_h: "human_rate(net_down)"
133133
net_up_h: "human_rate(net_up)"
@@ -155,11 +155,11 @@ pages:
155155
net_up: sum(rate(node_network_transmit_bytes_total{instance="proxmox.local:9100",device=~"en.*|eth.*|nic.*"}[2m]))
156156
derived:
157157
ram_pct: "100*(1-ram_a/ram_t)"
158-
ram_used_g: "(ram_t-ram_a)/1e9"
159-
ram_total_g: "ram_t/1e9"
158+
ram_used_g: "(ram_t-ram_a)/2**30"
159+
ram_total_g: "ram_t/2**30"
160160
disk_pct: "100*(1-disk_a/disk_t)"
161-
disk_used_g: "(disk_t-disk_a)/1e9"
162-
disk_total_g: "disk_t/1e9"
161+
disk_used_g: "(disk_t-disk_a)/2**30"
162+
disk_total_g: "disk_t/2**30"
163163
uptime: "str(int(up_s//86400))+'d '+str(int(up_s%86400//3600))+'h'"
164164
net_down_h: "human_rate(net_down)"
165165
net_up_h: "human_rate(net_up)"

0 commit comments

Comments
 (0)