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
| Name | What it does | Options | Default |
|---|---|---|---|
| cpu-threshold | percent CPU busy during the sample; default 90 | 90 | |
| mem-threshold | percent memory in use; default 90 | 90 | |
| swap-threshold | percent swap in use; default 50; 0 = off | 50 | |
| load-threshold | default 200; 1-minute load per CPU core as a percent, so 200 means load 2.0 per core | 200 | |
| disk-threshold | percent space used on any local filesystem; default 90 | 90 | |
| services | optional comma-separated services that must be running, for example sshd,cron | ||
| failed-units | count failed systemd services as a problem; default yes | yes, no | yes |
| sample | seconds to measure CPU; default 5 | 5 | |
| report-dir | CSV 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
- Run it on one test tenant or small OU and check the output and log.
- Check the exit code: 0 = OK, 1 = needs attention, 2 = error (see log), 9 = this copy is past its Valid until date.
- 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
| Version | Date | Changes |
|---|---|---|
| 1.0.0 | November 2026 | First release. |