diff --git a/low-disk-space.sh b/low-disk-space.sh new file mode 100644 index 0000000..598f5ae --- /dev/null +++ b/low-disk-space.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +mingigs=2 +avail=$(df | awk '$6 == "/" && $4 < '$mingigs' * 1024*1024 { print $4/1024/1024 }') +topicurl=https://ntfy.domain.tld/topic +token=token + +if [ -n "$avail" ]; then + curl \ + -d "Only $avail GB available on the root disk. Better clean that up." \ + -H "Title: Low disk space alert on $(hostname)" \ + -H "Priority: high" \ + -H "Tags: warning,cd" \ + -H "Authorization: Bearer $token" \ + $topicurl +fi \ No newline at end of file