Update monitor.yml
This commit is contained in:
parent
368291eb2d
commit
c385b98982
46
.github/workflows/monitor.yml
vendored
46
.github/workflows/monitor.yml
vendored
@ -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"
|
||||
STATUS=$(curl -s -o /dev/null -w "%{http_code}" "$URL")
|
||||
TIME=$(date "+%Y-%m-%d %H:%M:%S")
|
||||
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
|
||||
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" \
|
||||
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"
|
||||
fi
|
||||
if [[ "$STATUS" == "502" || "$STATUS" == "404" ]]; then
|
||||
curl -s \
|
||||
--form-string "token=${{ secrets.PUSHOVER_TOKEN }}" \
|
||||
--form-string "user=${{ secrets.PUSHOVER_USER }}" \
|
||||
--form-string "title=🔴 $NAME Alert" \
|
||||
--form-string "message=⚠️ $URL is down ($STATUS) at $TIME" \
|
||||
https://api.pushover.net/1/messages.json
|
||||
else
|
||||
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"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user