Page MenuHomeVyOS Platform

Rewrite "show system memory" in Python to make it usable as a library function
Closed, ResolvedPublic

Description

The show system memory script is still in shell and should be refreshed for two reasons:

First, newer kernel versions expose MemAvailable in /proc/cpuinfo, so the $total - $used - $buffers calculation is no longer needed. Worse yet, that calculation seems no longer accurate because the values don't add up. I'm not sure what's wrong there, but MemAvailableappears to correctly exclude disk cache from the "used" memory.

Second, if we are to expose the op mode in the remote API and then in the GUI, we need that code to be machine-friendly, importable from Python.

Third, on machines with large amounts of memory, megabyte values aren't very human-readable and we may want to normalize them to gigabytes.

Details

Version
-
Is it a breaking change?
Perfectly compatible

Event Timeline

syncer triaged this task as Normal priority.Aug 29 2022, 7:53 AM