diff --git a/README.md b/README.md index f5d24df..c059e21 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,24 @@ -# lab-monitor -External monitoring for my lab +# ๐Ÿ” Lab Monitor (Pushover + GitHub Actions) + +This repository monitors external URLs (e.g. your homelab services) and sends alerts via [Pushover](https://pushover.net) if any of them go down. + +## โœ… How It Works + +- Every 5 minutes, GitHub Actions runs a workflow that: + - Checks a list of URLs (e.g. https://woodpecker.dvirlabs.com) + - If the status code is 502 or 404, sends an alert via Pushover + +## ๐Ÿ” Setup + +1. Create a free [Pushover](https://pushover.net) account. +2. Get your **User Key** and **App Token**. +3. Go to your repo โ†’ Settings โ†’ Secrets โ†’ Actions โ†’ Add these: + - `PUSHOVER_USER` = your user key + - `PUSHOVER_TOKEN` = your app token + +## ๐Ÿงช Test + +Temporarily change the URL to something invalid and watch for a Pushover alert. + +--- +Powered by GitHub Actions ๐ŸŒ€ diff --git a/workflows/monitor.yml b/workflows/monitor.yml new file mode 100644 index 0000000..68740e5 --- /dev/null +++ b/workflows/monitor.yml @@ -0,0 +1,29 @@ +name: Monitor Lab URLs + +on: + schedule: + - cron: "*/5 * * * *" # Run every 5 minutes + workflow_dispatch: + +jobs: + monitor: + runs-on: ubuntu-latest + steps: + - name: Check Woodpecker URL + run: | + STATUS=$(curl -s -o /dev/null -w "%{http_code}" https://woodpecker.dvirlabs.com) + + if [[ "$STATUS" == "502" ]]; then + curl -s \ + --form-string "token=${{ secrets.PUSHOVER_TOKEN }}" \ + --form-string "user=${{ secrets.PUSHOVER_USER }}" \ + --form-string "message=โš ๏ธ Woodpecker is down (502)" \ + https://api.pushover.net/1/messages.json + elif [[ "$STATUS" == "404" ]]; then + curl -s \ + --form-string "token=${{ secrets.PUSHOVER_TOKEN }}" \ + --form-string "user=${{ secrets.PUSHOVER_USER }}" \ + --form-string "message=โŒ Woodpecker not found (404)" \ + https://api.pushover.net/1/messages.json + else + echo "โœ… All good: $STATUS"