welcome ghaymah
هذا الالتزام موجود في:
20
q1-deploy-monitor/health-check.sh
Normal file
20
q1-deploy-monitor/health-check.sh
Normal file
@@ -0,0 +1,20 @@
|
||||
#!/bin/bash
|
||||
|
||||
URL="http://localhost:8000/health"
|
||||
|
||||
echo "Starting application monitoring. Checking every 30 seconds..."
|
||||
|
||||
while true; do
|
||||
# Send HTTP GET request and get the status code
|
||||
RESPONSE=$(curl -s -o /dev/null -w "%{http_code}" $URL)
|
||||
TIMESTAMP=$(date '+%Y-%m-%d %H:%M:%S')
|
||||
|
||||
if [ "$RESPONSE" -eq 200 ]; then
|
||||
echo "[$TIMESTAMP] Status: HEALTHY (HTTP 200)"
|
||||
else
|
||||
echo "[$TIMESTAMP] Status: DOWN (HTTP $RESPONSE)"
|
||||
fi
|
||||
|
||||
# Wait for 30 seconds before the next check
|
||||
sleep 30
|
||||
done
|
||||
المرجع في مشكلة جديدة
حظر مستخدم