40 lines
1.3 KiB
YAML
40 lines
1.3 KiB
YAML
name: Monitor Lab URLs
|
|
|
|
on:
|
|
schedule:
|
|
- cron: "*/5 * * * *"
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
monitor:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Check services
|
|
run: |
|
|
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" || "$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" \
|
|
--form-string "priority=2" \
|
|
--form-string "retry=60" \
|
|
--form-string "expire=600" \
|
|
https://api.pushover.net/1/messages.json
|
|
else
|
|
echo "✅ $NAME is up: $STATUS"
|
|
fi
|
|
}
|
|
|
|
check_url "https://harbor.dvirlabs.com" "harbor"
|
|
check_url "https://woodpecker.dvirlabs.com" "woodpecker"
|
|
check_url "https://minio.dvirlabs.com" "minio"
|
|
check_url "https://grafana.dvirlabs.com" "grafana"
|
|
check_url "https://prometheus.dvirlabs.com" "prometheus"
|