How I Automated Web Server Checks with My Home Linux Server and Discord


How I Automated Web Server Checks with My Home Linux Server and Discord

Running multiple websites means I need to know right away if one of them goes down. Instead of relying on third-party uptime services, I decided to build my own lightweight monitoring system using my home Linux server and Discord.

This way, I get instant alerts straight to my phone or desktop whenever there’s a problem.


The Setup: Home Server + Discord Webhook

I already run a headless Debian server at home that I use for various tasks. It was the perfect place to run a monitoring script on a schedule.

For notifications, I used Discord webhooks because they’re easy to set up and send rich alerts directly to my private channel.


Step 1: Create a Discord Webhook

  1. Open Discord and go to the server where you want alerts.
  2. Go to Server Settings → Integrations → Webhooks.
  3. Create a new webhook and copy the URL.
  4. This URL is what the monitoring script will use to send messages.

Step 2: Write a Simple Monitoring Script

Here’s a basic Bash script I run from my home server to check websites:

#!/bin/bash

# List of sites to check
SITES=("https://brewzr3dprinting.com" "https://brucereiss.com")

# Your Discord webhook
WEBHOOK_URL="https://discord.com/api/webhooks/XXXX/XXXX"

for SITE in "${SITES[@]}"; do
  if curl -s --head --request GET "$SITE" | grep "200 OK" > /dev/null; then
    echo "$SITE is up"
  else
    curl -H "Content-Type: application/json" \
      -X POST \
      -d "{\"content\":\"🚨 $SITE appears to be down!\"}" \
      $WEBHOOK_URL
  fi
done

This script loops through a list of sites, checks their HTTP response, and sends a Discord alert if something isn’t working.


Step 3: Automate with Cron

To make it run automatically, I added it to my crontab:

crontab -e

And scheduled it to run every 5 minutes:

*/5 * * * * /home/user/check_sites.sh

Step 4: Enjoy Real-Time Alerts

Now, whenever a site fails a check, I get a Discord notification instantly. It’s lightweight, reliable, and fully under my control.


Why I Like This Setup

  • No dependency on third parties → I control the monitoring.
  • Discord alerts → reach me faster than email.
  • Scalable → easy to add more sites or checks (like SSL certificate expiration).
  • Fun project → combines my sysadmin background with my 3D printing business needs.

Conclusion

Automating server checks with my home Linux server and Discord keeps me ahead of downtime without paying for an external service. It’s a simple example of how you can take advantage of scripting and automation to make life easier as a website owner.


Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.