- 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
55 lines
1.4 KiB
Bash
55 lines
1.4 KiB
Bash
#!/bin/bash
|
|
# =============================================================================
|
|
# SAP HANA Common Configuration
|
|
# =============================================================================
|
|
|
|
# --- HANA Instance Configuration ---
|
|
# HANA SID (e.g., "NDB") - used to derive the HANA user (<sid>adm)
|
|
HANA_SID="NDB"
|
|
|
|
# Derived HANA Linux user (automatically computed from HANA_SID)
|
|
HANA_USER="$(echo "$HANA_SID" | tr '[:upper:]' '[:lower:]')adm"
|
|
|
|
# HANA Instance Number (e.g., "00")
|
|
HANA_INSTANCE_NR="00"
|
|
|
|
# HANA User Key for hdbsql (hdbuserstore key)
|
|
HANA_USER_KEY="CRONKEY"
|
|
|
|
# --- Paths ---
|
|
SAPCONTROL_PATH="/usr/sap/hostctrl/exe/sapcontrol"
|
|
HDBSQL_PATH="/usr/sap/HDB/HDB${HANA_INSTANCE_NR}/exe/hdbsql"
|
|
|
|
# --- Monitoring Directories ---
|
|
DIRECTORIES_TO_MONITOR=(
|
|
"/hana/shared"
|
|
"/hana/log"
|
|
"/hana/data"
|
|
"/usr/sap"
|
|
)
|
|
|
|
# --- Thresholds ---
|
|
DISK_USAGE_THRESHOLD=85
|
|
TRUNCATED_PERCENTAGE_THRESHOLD=50
|
|
FREE_PERCENTAGE_THRESHOLD=10
|
|
STATEMENT_QUEUE_THRESHOLD=10
|
|
STATEMENT_QUEUE_CONSECUTIVE_RUNS=3
|
|
BACKUP_THRESHOLD_HOURS=32
|
|
|
|
# --- Notification Configuration ---
|
|
NTFY_TOKEN=""
|
|
NTFY_TOPIC_URL=""
|
|
COMPANY_NAME="My Company"
|
|
|
|
# --- Logging Configuration ---
|
|
LOG_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd)"
|
|
LOG_FILE="${LOG_DIR}/hana_monitor.log"
|
|
|
|
# --- State Directory ---
|
|
STATE_DIR="${LOG_DIR}/monitor_state"
|
|
mkdir -p "${STATE_DIR}"
|
|
|
|
# --- Lock Directory ---
|
|
LOCK_DIR="/tmp"
|
|
|