From b627cf1d4a5e3976c0fd7c6c8f604b08039906a3 Mon Sep 17 00:00:00 2001 From: Sangelo Date: Fri, 10 May 2024 15:48:42 +0200 Subject: [PATCH] [d] remove healthcheck script --- hardening/healthcheck.sh | 35 ----------------------------------- 1 file changed, 35 deletions(-) delete mode 100644 hardening/healthcheck.sh diff --git a/hardening/healthcheck.sh b/hardening/healthcheck.sh deleted file mode 100644 index 0520ca7..0000000 --- a/hardening/healthcheck.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/bash - -# Configuration -HEALTH_URL="http://10.1.30.1:8080/health" -NTFY_INSTANCE="https://ntfy.lunivity.com" -NTFY_TOPIC="$NTFY_INSTANCE/mytopic" -CONFIGURABLE_MESSAGE="Something went wrong with the health check." -LOG_FILE="health_check.log" - -# Function to send push notification -send_notification() { - local message="$1" - local priority="$2" - local tags="$3" - curl -H "Title: Health Check Failure" \ - -H "Priority: $priority" \ - -H "Tags: $tags" \ - -d "$message" \ - "$NTFY_TOPIC" - if [ $? -ne 0 ]; then - echo "[$(date +"%Y-%m-%d %H:%M:%S")] - Failed to send push notification" >> "$LOG_FILE" - fi -} - -# 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