From e083c5b7492b420d0a04e7592aec6dc60ea32eff Mon Sep 17 00:00:00 2001 From: Tomi Eckert Date: Thu, 25 Sep 2025 18:38:41 +0200 Subject: [PATCH] fix(monitor): Remove 'local' from global variables and bump version to 1.2.1 Removed incorrect 'local' keyword from global variable declarations in monitor/monitor.sh as it's only valid within functions. Updated version to 1.2.1 in monitor/monitor.sh and packages.conf. --- monitor/monitor.sh | 8 ++++---- packages.conf | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/monitor/monitor.sh b/monitor/monitor.sh index b253d85..2fb1b39 100644 --- a/monitor/monitor.sh +++ b/monitor/monitor.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Version: 1.2.0 +# Version: 1.2.1 # ============================================================================= # SAP HANA Monitoring Script # @@ -193,7 +193,7 @@ last_backup_date=$("$HDBSQL_PATH" -U "$HANA_USER_KEY" -j -a -x \ if [[ -z "$last_backup_date" ]]; then # No successful backup found at all - local message="No successful complete data backup found for ${COMPANY_NAME} HANA." + message="No successful complete data backup found for ${COMPANY_NAME} HANA." echo "🚨 Critical: ${message}" send_notification_if_changed "hana_backup_status" "HANA Backup" "${message}" "true" "NO_BACKUP" return @@ -208,11 +208,11 @@ age_seconds=$((current_epoch - last_backup_epoch)) age_hours=$((age_seconds / 3600)) if (( age_seconds > threshold_seconds )); then - local message="Last successful HANA backup for ${COMPANY_NAME} is ${age_hours} hours old, which exceeds the threshold of ${BACKUP_THRESHOLD_HOURS} hours. Last backup was on: ${last_backup_date}." + message="Last successful HANA backup for ${COMPANY_NAME} is ${age_hours} hours old, which exceeds the threshold of ${BACKUP_THRESHOLD_HOURS} hours. Last backup was on: ${last_backup_date}." echo "🚨 Critical: ${message}" send_notification_if_changed "hana_backup_status" "HANA Backup" "${message}" "true" "${age_hours}h" else - local message="Last successful backup is ${age_hours} hours old (Threshold: ${BACKUP_THRESHOLD_HOURS} hours)." + message="Last successful backup is ${age_hours} hours old (Threshold: ${BACKUP_THRESHOLD_HOURS} hours)." echo "✅ Success! ${message}" send_notification_if_changed "hana_backup_status" "HANA Backup" "${message}" "false" "OK" fi diff --git a/packages.conf b/packages.conf index 56df2ea..118db03 100644 --- a/packages.conf +++ b/packages.conf @@ -10,7 +10,7 @@ declare -A SCRIPT_PACKAGES # Format: short_name="Display Name|Version|Description|URL1 URL2..." SCRIPT_PACKAGES["aurora"]="Aurora Suite|2.1.0|A collection of scripts for managing Aurora database instances.|https://git.technopunk.space/tomi/Scripts/raw/branch/main/aurora/aurora.sh https://git.technopunk.space/tomi/Scripts/raw/branch/main/aurora/aurora.conf" SCRIPT_PACKAGES["backup"]="Backup Suite|1.0.5|A comprehensive script for backing up system files and databases.|https://git.technopunk.space/tomi/Scripts/raw/branch/main/backup/backup.sh https://git.technopunk.space/tomi/Scripts/raw/branch/main/backup/backup.conf" -SCRIPT_PACKAGES["monitor"]="Monitor Suite|1.2.0|Scripts for monitoring system health and performance metrics.|https://git.technopunk.space/tomi/Scripts/raw/branch/main/monitor/monitor.sh https://git.technopunk.space/tomi/Scripts/raw/branch/main/monitor/monitor.conf" +SCRIPT_PACKAGES["monitor"]="Monitor Suite|1.2.1|Scripts for monitoring system health and performance metrics.|https://git.technopunk.space/tomi/Scripts/raw/branch/main/monitor/monitor.sh https://git.technopunk.space/tomi/Scripts/raw/branch/main/monitor/monitor.conf" SCRIPT_PACKAGES["keymanager"]="Key Manager|1.2.1|A utility for managing HDB user keys for SAP HANA.|https://git.technopunk.space/tomi/Scripts/raw/branch/main/keymanager.sh" SCRIPT_PACKAGES["cleaner"]="File Cleaner|1.1.0|A simple script to clean up temporary files and logs.|https://git.technopunk.space/tomi/Scripts/raw/branch/main/cleaner.sh" SCRIPT_PACKAGES["hanatool"]="HANA Tool|1.5.0|A command-line tool for various SAP HANA administration tasks.|https://git.technopunk.space/tomi/Scripts/raw/branch/main/hanatool.sh"