diff --git a/Monitoring/healthcheck.sh b/Monitoring/healthcheck.sh new file mode 100644 index 0000000..df85591 --- /dev/null +++ b/Monitoring/healthcheck.sh @@ -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 \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index 833d017..23f9fa0 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,5 +1,5 @@ services: - pics: + image-web: container_name: image-web image: caddy:2 volumes: diff --git a/src/routes/gallery/+page.svelte b/src/routes/gallery/+page.svelte index acb1b2f..df776c2 100644 --- a/src/routes/gallery/+page.svelte +++ b/src/routes/gallery/+page.svelte @@ -9,21 +9,21 @@