initial commit

This commit is contained in:
dvirlabs 2025-06-27 15:14:30 +03:00
parent c9c2131266
commit 1fb6893b11
2 changed files with 53 additions and 2 deletions

View File

@ -1,2 +1,24 @@
# lab-monitor # 🔍 Lab Monitor (Pushover + GitHub Actions)
External monitoring for my lab
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 🌀

29
workflows/monitor.yml Normal file
View File

@ -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"