Update monitor.yml

This commit is contained in:
dvirlabs 2025-06-27 18:05:23 +03:00
parent 368291eb2d
commit c385b98982

View File

@ -2,35 +2,33 @@ name: Monitor Lab URLs
on:
schedule:
- cron: "*/5 * * * *" # מריץ כל 5 דקות (שנה לפי הצורך)
- cron: "*/5 * * * *" # כל 5 דקות
workflow_dispatch:
jobs:
monitor:
runs-on: ubuntu-latest
steps:
- name: Check Woodpecker URL
- name: Check services
run: |
URL="https://woodpecker.dvirlabs.com"
check_url() {
URL=$1
NAME=$2
STATUS=$(curl -s -o /dev/null -w "%{http_code}" "$URL")
TIME=$(date "+%Y-%m-%d %H:%M:%S")
if [[ "$STATUS" == "502" ]]; then
if [[ "$STATUS" == "502" || "$STATUS" == "404" ]]; then
curl -s \
--form-string "token=${{ secrets.PUSHOVER_TOKEN }}" \
--form-string "user=${{ secrets.PUSHOVER_USER }}" \
--form-string "title=🚨 Woodpecker Alert" \
--form-string "message=⚠️ $URL is down (502) at $TIME" \
--form-string "title=🔴 $NAME Alert" \
--form-string "message=⚠️ $URL is down ($STATUS) at $TIME" \
https://api.pushover.net/1/messages.json
exit 1
elif [[ "$STATUS" == "404" ]]; then
curl -s \
--form-string "token=${{ secrets.PUSHOVER_TOKEN }}" \
--form-string "user=${{ secrets.PUSHOVER_USER }}" \
--form-string "title=🚨 Woodpecker Alert" \
--form-string "message=❌ $URL returned 404 at $TIME" \
https://api.pushover.net/1/messages.json
exit 1
else
echo "✅ Woodpecker is up: $STATUS"
echo "✅ $NAME is up: $STATUS"
fi
}
check_url "https://woodpecker.dvirlabs.com" "Woodpecker"
check_url "https://grafana.dvirlabs.com" "Grafana"
check_url "https://vault.dvirlabs.com" "Vault"