What It Does
The script checks three things and alerts when any of them is past its limit. First, free disk space on every local volume (ext, xfs, btrfs and zfs), against MIN_DISK_FREE_PERCENT. The script takes one mount point per device and then applies EXCLUDE_MOUNTS to those selected paths.
Second, available memory, which uses MemAvailable where present and otherwise estimates it from free RAM, buffers and cache, against MIN_MEMORY_AVAILABLE_PERCENT. Third, the 5-minute load average as a percentage of the CPU count, against MAX_LOAD_PERCENT. This is load divided by CPU count, not CPU utilization. A load of 8 on 4 CPUs reports 200 percent.
Set a limit to 0 to switch that check off. The table has one row per check with its value and limit, and the answer names every limit that was crossed. Nothing is changed.
Before You Run It
- Pick limits that fit the server and its work. The defaults are 10 percent free, 10 percent available and a load of 200 percent of the CPUs.
- The load check uses the kernel's five-minute average. Use it to spot sustained pressure and confirm the cause separately.
- Use EXCLUDE_MOUNTS for volumes that stay full on purpose, such as a read-only image.
- It was run on Ubuntu 24.04. The same commands exist on Debian 12 and RHEL, Rocky and Alma 9, but those are written for rather than run.
Type and Risk
- Type: Monitor. It checks one condition. It exits 1 when it finds the problem, so your RMM can alert on it, 0 when all is well, and 2 when it could not run.
- Risk: Low. It reads and changes nothing.
- Restart: It never restarts the machine.
- Typical run: Under 5 seconds.
- Example answer: "Disk / 8% free (limit 10%); Load 250% of 4 CPU(s) (limit 200%)"
- Tested before listing on Ubuntu 24.04 (Arm64 VM) with bash, run as root, against its own test cases.
Inputs
Pass an input as an argument (--input-name value), as an environment variable named as listed, which is how most RMMs pass script variables, or change its default in the DEFAULT_ lines near the top of the script. An argument wins over an environment variable, which wins over the default.
- MIN_DISK_FREE_PERCENT: Alert when a volume has less than this % free. 0-99, 0 = off. Default 10.
- MIN_MEMORY_AVAILABLE_PERCENT: Alert when less than this % of RAM is available. 0-99, 0 = off. Default 10.
- MAX_LOAD_PERCENT: Alert when the 5-minute load is above this % of the CPU count. 0-10000, 0 = off. Default 200.
- EXCLUDE_MOUNTS: Mount points to skip, comma-separated. Default none.
Every script also takes DRY_RUN, OUTPUT_FORMAT (Text, Answer, Json or Csv), EXPORT_PATH and RESULT_FIELD, which writes the answer to an RMM custom field, unless the list above words one differently.
License
Provided "as is" under the MIT License, without warranty of any kind. Test before production use. MSP Outpost and User First Digital Inc. accept no liability for any damage or loss.