update monitor.yml from monitoring.yaml
This commit is contained in:
parent
5a37d95600
commit
e8855b5b0f
20
.github/workflows/monitor.yml
vendored
20
.github/workflows/monitor.yml
vendored
@ -9,24 +9,21 @@ jobs:
|
|||||||
monitor:
|
monitor:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Check all URLs
|
- name: Check services
|
||||||
run: |
|
run: |
|
||||||
check_url() {
|
check_url() {
|
||||||
URL=$1
|
URL=$1
|
||||||
NAME=$2
|
NAME=$2
|
||||||
CODE=$3
|
|
||||||
MESSAGE=$4
|
|
||||||
PRIORITY=$5
|
|
||||||
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" == "$CODE" ]]; 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=🔴 $NAME Alert" \
|
--form-string "title=🔴 $NAME Alert" \
|
||||||
--form-string "message=$MESSAGE at $TIME" \
|
--form-string "message=⚠️ $URL is down ($STATUS) at $TIME" \
|
||||||
--form-string "priority=$PRIORITY" \
|
--form-string "priority=2" \
|
||||||
--form-string "retry=60" \
|
--form-string "retry=60" \
|
||||||
--form-string "expire=600" \
|
--form-string "expire=600" \
|
||||||
https://api.pushover.net/1/messages.json
|
https://api.pushover.net/1/messages.json
|
||||||
@ -34,9 +31,6 @@ jobs:
|
|||||||
echo "✅ $NAME is up: $STATUS"
|
echo "✅ $NAME is up: $STATUS"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
check_url "https://woodpecker.dvirlabs.com" "harbor" "502" "⚠️ harbor down (502)" "2"
|
|
||||||
check_url "https://woodpecker.dvirlabs.com" "harbor" "404" "⚠️ harbor down (404)" "0"
|
check_url "https://woodpecker.dvirlabs.com" "harbor"
|
||||||
check_url "https://woodpecker.dvirlabs.com" "harbor" "1033" "⚠️ harbor down (1033)" "2"
|
check_url "https://woodpecker.dvirlabs.com" "woodpecker"
|
||||||
check_url "https://woodpecker.dvirlabs.com" "woodpecker" "502" "⚠️ woodpecker down (502)" "2"
|
|
||||||
check_url "https://woodpecker.dvirlabs.com" "woodpecker" "404" "⚠️ woodpecker down (404)" "0"
|
|
||||||
check_url "https://woodpecker.dvirlabs.com" "woodpecker" "1033" "⚠️ woodpecker down (1033)" "2"
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user