Complete Ghaymah Internship Assessment
هذا الالتزام موجود في:
20
deploy-monitor/health-check.sh
Normal file
20
deploy-monitor/health-check.sh
Normal file
@@ -0,0 +1,20 @@
|
||||
#!/bin/bash
|
||||
|
||||
URL="http://localhost:8000/health"
|
||||
|
||||
echo "Starting Health Monitor..."
|
||||
|
||||
while true
|
||||
do
|
||||
RESPONSE=$(curl -s -o /dev/null -w "%{http_code}" $URL)
|
||||
TIME=$(curl -s -o /dev/null -w "%{time_total}" $URL)
|
||||
DATE=$(date +"%Y-%m-%d %H:%M:%S")
|
||||
|
||||
if [ "$RESPONSE" = "200" ]; then
|
||||
echo "[$DATE] STATUS: UP | HTTP: $RESPONSE | Response Time: ${TIME}s"
|
||||
else
|
||||
echo "[$DATE] STATUS: DOWN | HTTP: $RESPONSE"
|
||||
fi
|
||||
|
||||
sleep 30
|
||||
done
|
||||
المرجع في مشكلة جديدة
حظر مستخدم