SMS Alerts for Server Monitoring

SMS alerts reach you when email and chat do not: at night, on the road, with a muted phone. With curl-sms, any script or monitoring tool that can make an HTTP request sends one.

A health check in 10 lines

#!/usr/bin/env bash
# Run every 5 minutes from cron: */5 * * * * /usr/local/bin/check-site.sh
URL="https://example.com/health"
: "${CURLSMS_KEY:?set CURLSMS_KEY}"

if ! curl -fsS --max-time 10 "$URL" >/dev/null; then
  curl -sS https://curl-sms.com/api/sms/send \
    -H "Authorization: Bearer $CURLSMS_KEY" \
    -H "Content-Type: application/json" \
    -H "Idempotency-Key: down-$(date +%Y%m%d%H)" \
    -d "{\"receiver\":\"+4915123456789\",\"body\":\"$URL is down\"}"
fi

The Idempotency-Key changes once per hour. While the site stays down, you get one SMS per hour instead of one every five minutes.

Connect your monitoring tool

  • Tools with a configurable webhook (custom URL, header and JSON body), such as Uptime Kuma's webhook notification or a Zabbix webhook media type: point it at POST https://curl-sms.com/api/sms/send with Authorization: Bearer … and a body {"receiver":"…","body":"…"}.
  • Tools with a fixed webhook format, such as Prometheus Alertmanager: put a small relay in between that reads the alert and calls the API, for example with the Python or Go example.
  • Tools that only send email: the curl-sms app for Synology NAS and the curl-sms Bridge (Docker, Linux, Windows, macOS) have an SMTP input that turns mails into SMS. See email to SMS.

These are generic HTTP and email integrations, not official plugins.

Tips

  • Test first: use a test key (cs_test_…). The whole chain runs, nothing is sent or charged.
  • Keep alerts short: host, problem, time. One SMS part holds 160 characters; emoji cut that to 70.
  • Don't miss the alert about the alert: set a spend limit and a low-balance webhook (billing.balance_low) so your alerts never stop silently. Without balance, the API answers 402.
  • Check delivery: rely on status sent. delivered is an extra confirmation from the network and may be missing abroad.