[c] change to test Container connection

This commit is contained in:
LogolicusZ 2024-05-06 20:44:49 +02:00
parent 696245b3da
commit 3aeac7f3a8
3 changed files with 30 additions and 12 deletions

18
Monitoring/healthcheck.sh Normal file
View file

@ -0,0 +1,18 @@
#!/bin/bash
# Configuration
HEALTH_URL="http://10.1.30.1:8080/health"
CONFIGURABLE_MESSAGE="Something went wrong with the health check."
LOG_FILE="health_check.log"
# Perform curl request
HEALTH_RESPONSE=$(curl -s -w "%{http_code}" "$HEALTH_URL")
HTTP_CODE=$(echo "$HEALTH_RESPONSE" | tail -n1)
CONTENT=$(echo "$HEALTH_RESPONSE" | head -n -1)
if [ "$HTTP_CODE" == "200" ] && [ "$CONTENT" == "OK" ]; then
echo "[$(date +"%Y-%m-%d %H:%M:%S")] - Successful response from health check at '$HEALTH_URL' - Response: 'OK'" >> "$LOG_FILE"
else
echo "[$(date +"%Y-%m-%d %H:%M:%S")] - Failed response from health check at '$HEALTH_URL' - HTTP Code: '$HTTP_CODE' - Content: '$CONTENT'" >> "$LOG_FILE"
echo "[$(date +"%Y-%m-%d %H:%M:%S")] - Sending a push notification..." >> "$LOG_FILE"
send_notification "$CONFIGURABLE_MESSAGE" "urgent" "warning"
fi

View file

@ -1,5 +1,5 @@
services:
pics:
image-web:
container_name: image-web
image: caddy:2
volumes:

View file

@ -9,21 +9,21 @@
</div>
<div class="grid">
<div><img class="gallery-image" src="http://localhost:3001/pic1.png" alt="pic1"></div>
<div><img class="gallery-image" src="http://localhost:3001/pic2.png" alt="pic2"></div>
<div><img class="gallery-image" src="http://localhost:3001/pic3.png" alt="pic3"></div>
<div><img class="gallery-image" src="http://image-web:80/pic1.png" alt="pic1"></div>
<div><img class="gallery-image" src="http://image-web:80/pic2.png" alt="pic2"></div>
<div><img class="gallery-image" src="http://image-web:80/pic3.png" alt="pic3"></div>
</div>
<div class="grid">
<div><img class="gallery-image" src="http://localhost:3001/pic4.png" alt="pic6"></div>
<div><img class="gallery-image" src="http://localhost:3001/pic5.png" alt="pic7"></div>
<div><img class="gallery-image" src="http://localhost:3001/pic6.png" alt="pic3"></div>
<div><img class="gallery-image" src="http://localhost:3001/pic7.png" alt="pic5"></div>
<div><img class="gallery-image" src="http://image-web:80/pic4.png" alt="pic6"></div>
<div><img class="gallery-image" src="http://image-web:80/pic5.png" alt="pic7"></div>
<div><img class="gallery-image" src="http://image-web:80/pic6.png" alt="pic3"></div>
<div><img class="gallery-image" src="http://image-web:80/pic7.png" alt="pic5"></div>
</div>
<div class="grid">
<div><img class="gallery-image" src="http://localhost:3001/pic8.png" alt="pic8"></div>
<div><img class="gallery-image" src="http://localhost:3001/pic9.png" alt="pic9"></div>
<div><img class="gallery-image" src="http://localhost:3001/pic10.png" alt="pic10"></div>
<div><img class="gallery-image" src="http://localhost:3001/pic1.png" alt="pic4"></div>
<div><img class="gallery-image" src="http://image-web:80/pic8.png" alt="pic8"></div>
<div><img class="gallery-image" src="http://image-web:80/pic9.png" alt="pic9"></div>
<div><img class="gallery-image" src="http://image-web:80/pic10.png" alt="pic10"></div>
<div><img class="gallery-image" src="http://image-web:80/pic1.png" alt="pic4"></div>
</div>
<style>