low-disk-space.sh hinzugefügt

This commit is contained in:
sujiba 2024-09-16 22:33:45 +00:00
parent 8431fd008c
commit 9398a14b99

16
low-disk-space.sh Normal file
View file

@ -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