A cron job runs at night. Log files grow, the disk starts filling up. You come in the next morning to find the disk at one hundred percent and services down. An email had been sent — but nobody read it.
Disk space monitoring is one of the most classic Linux sysadmin scenarios. The solution looks simple: write a script, add it to cron, send an email. But if nobody reads that email at night, the alert is useless.
Is Voice Alerting Possible on Linux?
Yes — sending a webhook with curl is all it takes.
On Linux, an HTTP POST request can be sent to Alertalk when any condition is met, triggering a phone call. No extra libraries or tools are needed. If your server has curl, this integration works.
How it works: Bash Script → curl → Alertalk API → Phone Call
Alertalk Webhook Structure
Alertalk webhook works as follows:
- URL:
https://tr.alertalk.net/webhook/receive - Method:
POST - Header:
X-Webhook-Key: {your key from the Alertalk panel} - Header:
Content-Type: application/json - Body:
{"phone_number": "5XXXXXXXXX", "error_message": "Your alert message"}
Basic Disk Alert Script
The following script checks disk usage and triggers a phone call via Alertalk when the threshold is exceeded.
#!/bin/bash
WEBHOOK_URL="https://tr.alertalk.net/webhook/receive"
WEBHOOK_KEY="your-alertalk-key-here"
PHONE="5XXXXXXXXX"
THRESHOLD=85
HOSTNAME=$(hostname)
DISK_USAGE=$(df / | awk 'NR==2 {print $5}' | tr -d '%')
if [ "$DISK_USAGE" -ge "$THRESHOLD" ]; then
MESSAGE="Disk alert: $HOSTNAME disk usage is at $DISK_USAGE percent. Immediate action required."
curl -s -X POST "$WEBHOOK_URL" \
-H "X-Webhook-Key: $WEBHOOK_KEY" \
-H "Content-Type: application/json" \
-d "{\"phone_number\": \"$PHONE\", \"error_message\": \"$MESSAGE\"}"
fi
Running Automatically with Cron
Make the script executable and open crontab:
chmod +x /opt/scripts/disk_alarm.sh
crontab -e
Add this crontab line:
*/5 * * * * /opt/scripts/disk_alarm.sh >> /var/log/disk_alarm.log 2>&1
Which Threshold Should You Use?
| Disk Usage | Status | Recommended Action |
|---|---|---|
| Below 70% | Normal | Monitor |
| 70% - 80% | Caution | Email notification sufficient |
| 80% - 90% | Warning | Voice alert should trigger |
| Above 90% | Critical | Immediate action required |
The right threshold depends on the environment. 75% is a reasonable starting point for database servers, 85% for log servers.
Monitoring Multiple Mount Points
To monitor all partitions, not just the root disk:
#!/bin/bash
WEBHOOK_URL="https://tr.alertalk.net/webhook/receive"
WEBHOOK_KEY="your-alertalk-key-here"
PHONE="5XXXXXXXXX"
THRESHOLD=85
HOSTNAME=$(hostname)
df -H | grep -vE "^Filesystem|tmpfs|cdrom|udev" | awk '{ print $5 " " $6 }' | while read -r output; do
USAGE=$(echo "$output" | awk '{ print $1}' | cut -d'%' -f1)
MOUNT=$(echo "$output" | awk '{ print $2 }')
if [ "$USAGE" -ge "$THRESHOLD" ]; then
MESSAGE="Disk alert: $HOSTNAME - $MOUNT is at $USAGE percent."
curl -s -X POST "$WEBHOOK_URL" \
-H "X-Webhook-Key: $WEBHOOK_KEY" \
-H "Content-Type: application/json" \
-d "{\"phone_number\": \"$PHONE\", \"error_message\": \"$MESSAGE\"}"
fi
done
Not Just Disk
The same pattern works for any condition. The webhook call stays the same — only what you check changes:
- High CPU usage
- A service stopped responding
- A specific log line detected
- A file changed or was deleted
- Network connectivity lost
Anything you can check with Bash can be turned into a voice alert via Alertalk webhook.
Who Is This For?
Ideal for system administrators who prefer a lightweight script solution over installing a full monitoring stack. You can get voice alerts for specific conditions without Zabbix or PRTG. Particularly useful in small environments or for custom scenarios that monitoring tools do not cover.
Setup Guide
For step-by-step instructions on creating an Alertalk account, getting a webhook key and running your first test: