#!/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