Adding application and DockerImage
هذا الالتزام موجود في:
19
q1-deploy-monitor/health-check.sh
Executable file
19
q1-deploy-monitor/health-check.sh
Executable file
@@ -0,0 +1,19 @@
|
||||
#!/bin/sh
|
||||
|
||||
URL="http://localhost:3000/health"
|
||||
|
||||
while true; do
|
||||
timestamp=$(date +"%H:%M:%S %d/%m/%Y")
|
||||
output=$(curl -s -o /dev/null -w "%{http_code} %{time_total}" "$URL")
|
||||
status_code=$(printf '%s' "$output" | awk '{print $1}')
|
||||
response_time=$(printf '%s' "$output" | awk '{print $2}')
|
||||
|
||||
if [ "$status_code" = "200" ]; then
|
||||
status="UP"
|
||||
else
|
||||
status="DOWN"
|
||||
fi
|
||||
|
||||
printf '%s | %s | %ss\n' "$timestamp" "$status" "$response_time"
|
||||
sleep 30
|
||||
done
|
||||
المرجع في مشكلة جديدة
حظر مستخدم