script_collection/low-disk-space.sh

16 lines
433 B
Bash
Raw Normal View History

2024-09-16 22:33:45 +00:00
#!/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