Get a Text When a Disk Is Full or Backups Stop

diskcheck texts you when a disk passes 90% full (you can change that), and, if you like, when your newest backup file is too old, which usually means backups have quietly stopped. One text per problem, then a "back to normal" when it clears.

What the texts look like

NAS1: disk /data 93% full; newest backup in /backups is 30h old
NAS1: disks and backups back to normal

1. Get your API key

It's on your account screen. No account yet? Start a free trial, then add your mobile number on the account screen so alerts come by text.

Easiest: run uxsend once. It asks for the key and saves it, and the other example programs then find it automatically. Or set it yourself in USERALERTX_API_KEY.

2. Download and try it

Windows: diskcheck.ps1. In PowerShell:

.\diskcheck.ps1                                   # every disk, alert at 90% used
.\diskcheck.ps1 -BackupPath D:\Backups -MaxAgeHours 26

Mac / Linux: diskcheck.sh:

./diskcheck.sh                   # every mounted disk, alert at 90% used
./diskcheck.sh -p 80             # alert at 80% instead
./diskcheck.sh -b /backups -h 26 # newest file in /backups must be under 26 hours old

It prints what it found, for example "all OK".

Test without sending: set USERALERTX_DRYRUN=1 (Mac/Linux) or $env:USERALERTX_DRYRUN="1" (PowerShell), and it shows the text it would send instead.

3. Run it every day

Windows (one command in a Command Prompt, daily at 7 am; change the path):

schtasks /create /sc daily /st 07:00 /tn "UserAlertX diskcheck" /tr "powershell -NoProfile -ExecutionPolicy Bypass -File C:\UserAlertX\diskcheck.ps1 -BackupPath D:\Backups"

Mac / Linux: run crontab -e and add:

0 7 * * * /home/you/diskcheck.sh -b /backups -h 26

Good to know

  • Cost: nothing while all is well; 1 token per text when something changes.
  • How it remembers: what it already told you about is kept in ~/.useralertx_diskcheck, so a full disk texts you once, not every day.
  • Backups: "too old" means the newest file in the backup folder. Pick an hour count a bit over your backup schedule, such as 26 for a nightly backup.