Prerequisites
Before setting up disk alerts, make sure you have:
- SSH access to your VPS
- Root or sudo privileges
Method 1: Configure Alert in HestiaCP
Edit Hestia config:
nano /usr/local/hestia/conf/hestia.conf
Set disk alert threshold:
DISK_ALERT='85' # Alert at 85% usage
Save and restart Hestia:
systemctl restart hestia
Method 2: Create Custom Disk Alert Script
nano /usr/local/bin/disk-alert.sh
Add content:
#!/bin/bash
THRESHOLD=85
EMAIL="admin@example.com"
USAGE=$(df -h / | awk 'NR==2 {print $5}' | sed 's/%//')
if [ $USAGE -gt $THRESHOLD ]; then
echo "Warning: Disk usage is at ${USAGE}% on $(hostname)" | mail -s "Disk Space Alert: $(hostname)" $EMAIL
fi
USAGE_HOME=$(df -h /home | awk 'NR==2 {print $5}' | sed 's/%//')
if [ $USAGE_HOME -gt $THRESHOLD ]; then
echo "Warning: /home disk usage is at ${USAGE_HOME}% on $(hostname)" | mail -s "/home Disk Alert" $EMAIL
fi
Make executable:
chmod +x /usr/local/bin/disk-alert.sh
Add to cron (run hourly):
crontab -e
Add:
0 * * * * /usr/local/bin/disk-alert.sh
Check Disk Usage Per User (HestiaCP)
/usr/local/hestia/bin/v-list-users
Shows disk usage for each user.
Get Disk Alert via Telegram (Optional)
Add to script:
curl -s -X POST https://api.telegram.org/botYOUR_BOT_TOKEN/sendMessage -d chat_id=YOUR_CHAT_ID -d text="Disk Alert: ${USAGE}% used on $(hostname)"
✅ Disk usage alerts have been configured!