Library / Linux

LINUX-005 · Script

Report System Resource Health

Summarizes CPU, memory, swap, load, disk space and service status, compares them with thresholds you set, and writes a CSV so you can see at a glance whether the system needs attention.

Version 1.0.0Language bashUpdated November 2026Report only, changes nothing

What it does

Read-only. Memory in use is based on MemAvailable, so file cache does not count as used. The top five processes by CPU and memory are logged to help explain a high reading.

Requirements

Any Linux with /proc and df. systemd for the service checks. Root recommended. No prompts.

How to run it

  • Run from: an admin workstation or scheduled task with the Microsoft modules installed and app sign-in configured
  • This is an admin script for your Linux tenant, not a per-device endpoint script
  • User interaction: none with app-only sign-in
  • Schedule: run on demand, or weekly for reports

Settings

NameWhat it doesOptionsDefault
cpu-thresholdpercent CPU busy during the sample; default 9090
mem-thresholdpercent memory in use; default 9090
swap-thresholdpercent swap in use; default 50; 0 = off50
load-thresholddefault 200; 1-minute load per CPU core as a percent, so 200 means load 2.0 per core200
disk-thresholdpercent space used on any local filesystem; default 9090
servicesoptional comma-separated services that must be running, for example sshd,cron
failed-unitscount failed systemd services as a problem; default yesyes, noyes
sampleseconds to measure CPU; default 55
report-dirCSV folder; default /var/lib/runbookia/reports/var/lib/runbookia/reports

Exit codes

  • 0 = Everything is within the thresholds
  • 1 = One or more checks need attention
  • 2 = Script error

Testing steps

  1. Run it on one test tenant or small OU and check the output and log.
  2. Check the exit code: 0 = OK, 1 = needs attention, 2 = error (see log), 9 = this copy is past its Valid until date.
  3. Roll out to a small group next, then everyone.

Rollback steps

Report only. Nothing is changed, so nothing needs to be rolled back.

Version and change log

VersionDateChanges
1.0.0November 2026First release.