Files
loc_az_hci/scripts/monitoring/setup-alerts.sh
defiQUG c39465c2bd
Some checks failed
Test / test (push) Has been cancelled
Initial commit: loc_az_hci (smom-dbis-138 excluded via .gitignore)
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-08 09:04:46 -08:00

64 lines
1.4 KiB
Bash
Executable File

#!/bin/bash
source ~/.bashrc
# Setup Alerts
# Configures alerting rules and notification channels
set -e
# Colors
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m'
log_info() {
echo -e "${GREEN}[INFO]${NC} $1"
}
log_warn() {
echo -e "${YELLOW}[WARN]${NC} $1"
}
setup_prometheus_alerts() {
log_info "Setting up Prometheus alerts..."
if ! command -v kubectl &> /dev/null; then
log_warn "kubectl not found, skipping Prometheus alert setup"
return 0
fi
log_info "Prometheus alert rules should be configured via:"
log_info " - Prometheus Operator Alertmanager"
log_info " - Custom Resource Definitions (CRDs)"
log_info " - GitOps manifests"
log_warn "Manual configuration required for alert rules"
}
setup_azure_alerts() {
log_info "Setting up Azure alerts..."
if ! command -v az &> /dev/null; then
log_warn "Azure CLI not found, skipping Azure alert setup"
return 0
fi
log_info "Azure alerts should be configured via:"
log_info " - Azure Portal: Monitor > Alerts"
log_info " - Azure CLI: az monitor metrics alert create"
log_info " - Terraform: azurerm_monitor_metric_alert"
log_warn "Manual configuration required for Azure alerts"
}
main() {
log_info "Setting up alerting..."
setup_prometheus_alerts
setup_azure_alerts
log_info "Alert setup complete (manual configuration may be required)"
}
main "$@"