Skip to content

[BUG] CPU usage gauge always shows 100% when rev is missing #476

Description

@stephdl

Describe the bug
The CPU usage gauge on the health monitor page always shows 100% (red), regardless of actual system load. This happens even when uptime/loadavg reports very low load (e.g. 0.2-0.6).

To Reproduce

  1. Run piler on Ubuntu 26.04
  2. Open the health monitor page in the admin UI.
  3. Look at the "CPU usage" bar.
  4. It always shows 100%, even under near-idle load.

Root cause:

  • model/health/health.php runs CPU_USAGE_COMMAND (config.php), defined as:
    LC_ALL=C mpstat | tail -1 | rev | awk '{ print $1 }' | rev
  • This pipes mpstat output through rev twice to read the last column from the right.
  • If the rev binary is missing, the whole pipeline silently returns an empty string.
  • health.php then does $this->data['cpuinfo'] = 100 - (int)$x;.
  • (int)"" evaluates to 0, so cpuinfo becomes 100 - 0 = 100.
  • Result: gauge always shows 100%, with no error or warning anywhere.

On recent Ubuntu releases 26.04, rev moved from the bsdutils package to bsdextrautils. Neither package is a direct dependency of sysstat (which provides mpstat), so on a minimal install rev can be absent while mpstat works fine.

Expected behavior

  • The CPU usage gauge should reflect real CPU load.
  • If the underlying command fails or returns unexpected output, the health page should show something like "N/A" or a clear error, not silently fall back to a misleading 100%.

Screenshots
See attached screenshot: uptime/load average shows 0.27, 0.28, 0.13, but the CPU usage bar is full red at 100%.

Image

Piler version:
piler 1.4.9-d3f4b07, Build Date: Wed Jun 17 03:34:01 UTC 2026

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions