Files

64 lines
1.4 KiB
Bash
Raw Permalink Normal View History

#!/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 "$@"