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