Library / Linux

LINUX-002 · Script

Alert on High Disk Usage

Checks space and inode usage on every local filesystem (or the ones you list) and raises an alert when a threshold is exceeded: exit code 1 for your RMM, plus optional syslog, webhook and email alerts.

Version 1.0.0Language bashUpdated November 2026Report only, changes nothing

What it does

Read-only. Nothing is deleted or changed. Network filesystems (nfs, cifs) are checked like any other unless you add their type to --exclude-types. The webhook URL is treated as a secret and is never written to the log.

Requirements

Any Linux with df (coreutils). Root recommended. curl for --webhook-url, mail or sendmail for --email. 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
thresholdpercent space used that triggers an alert; default 9090
inode-thresholddefault 90; percent inodes used that triggers an alert; 0 turns the inode check off90
mountscomma-separated mount points to check, for example /,/var,/home; default all
exclude-typescomma-separated filesystem types to skip; leave empty for the built-in list: tmpfs, devtmpfs, squashfs, overlay, iso9660, ramfs, efivarfs
syslogwrite alerts to syslog with logger; default yesyes, noyes
webhook-urloptional; posts a JSON body with a text field, for example a chat incoming webhook
emailoptional; needs a working mail or sendmail
report-dirCSV of every checked filesystem; default /var/lib/runbookia/reports/var/lib/runbookia/reports

Exit codes

  • 0 = All checked filesystems are below the thresholds
  • 1 = One or more filesystems are over a threshold (alert sent if configured)
  • 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.