refactor(monitoring): simplify notification system and remove auto-cleanup

- Replace state-based notifications with direct alert functions
- Remove auto-cleanup functionality from disk monitoring and configuration
- Simplify lock acquisition/release across all monitoring scripts
- Add execute_hana_sql helper functions for consistent SQL execution
- Remove state file tracking in favor of direct file operations
- Standardize error handling with exit codes on critical failures
- Clean up hana.conf by removing unused auto-delete directory settings
This commit is contained in:
2026-03-12 21:52:49 +01:00
parent 5a92bc4e93
commit cf5b81889d
8 changed files with 183 additions and 391 deletions

View File

@@ -28,29 +28,6 @@ DIRECTORIES_TO_MONITOR=(
"/usr/sap"
)
# --- Directories for Auto-Delete ---
# These directories will be automatically cleaned when disk space is low
# Format: "mount_point:directory_path"
# The script will check if a monitored directory is on the same mount point
# as an auto-delete directory and can clean it to free up space
# NOTE: Do NOT include HANA system logs like /hana/log - only include
# directories with safe-to-delete files like backup logs, temp files, etc.
DIRS_FOR_AUTODELETE=(
"/hana/shared:/hana/shared/backup/schema/DB_NDB"
"/hana/shared:/hana/shared/backup/schema/SYSTEMDB"
"/hana/data:/hana/data/temp"
"/usr/sap:/usr/sap/trans/log"
"/usr/sap:/usr/sap/hostctrl/work/log"
)
# --- Disk Auto-Delete Configuration ---
# Minimum free space percentage to maintain after cleanup
MIN_FREE_SPACE_AFTER_CLEANUP=5
# Maximum age of files to delete (in days)
MAX_FILE_AGE_DAYS=7
# Enable automatic cleanup when disk usage exceeds threshold
AUTO_CLEANUP_ENABLED=true
# --- Thresholds ---
DISK_USAGE_THRESHOLD=85
TRUNCATED_PERCENTAGE_THRESHOLD=50