import { MetricsAlert } from './systemMetricsCollector'; /** * Alert Configuration */ export interface AlertingConfig { enabled: boolean; evaluationIntervalMs: number; alertRetentionMs: number; maxActiveAlerts: number; suppressDuplicates: boolean; duplicateWindowMs: number; escalationEnabled: boolean; escalationDelayMs: number; channels: { console: boolean; webhook: boolean; email: boolean; }; webhookUrl?: string; emailConfig?: { smtp: string; from: string; to: string[]; }; } /** * Alert Rule Definition */ export interface AlertRule { id: string; name: string; description: string; enabled: boolean; severity: 'low' | 'medium' | 'high' | 'critical'; category: 'memory' | 'performance' | 'health' | 'configuration' | 'security'; condition: { metric: string; operator: '>' | '<' | '==' | '!=' | '>=' | '<='; threshold: number; duration?: number; }; actions: Array<{ type: 'log' | 'webhook' | 'email' | 'escalate' | 'auto_remediate'; config?: any; }>; suppressionRules?: Array<{ condition: string; duration: number; }>; } /** * Alert Instance */ export interface AlertInstance extends MetricsAlert { ruleId: string; ruleName: string; escalated: boolean; escalatedAt?: number; acknowledgements: Array<{ userId: string; timestamp: number; comment?: string; }>; autoRemediation?: { attempted: boolean; attemptedAt: number; success: boolean; actions: string[]; }; } /** * Alert Notification */ export interface AlertNotification { alertId: string; timestamp: number; channel: 'console' | 'webhook' | 'email'; status: 'pending' | 'sent' | 'failed'; retryCount: number; error?: string; } /** * Alerting System * Comprehensive alert management, escalation, and notification system */ export declare class AlertingSystem { private static instance; private config; private alertRules; private activeAlerts; private alertHistory; private notifications; private evaluationTimer?; private lastEvaluation; private constructor(); static getInstance(config?: AlertingConfig): AlertingSystem; /** * Start alert evaluation */ startAlerting(): void; /** * Stop alert evaluation */ stopAlerting(): void; /** * Evaluate all alert rules against current metrics */ private evaluateAlerts; /** * Evaluate individual alert rule */ private evaluateRule; /** * Extract metric value from performance metrics */ private extractMetricValue; /** * Create alert instance from rule */ private createAlertInstance; /** * Check if alert is a duplicate within suppression window */ private isDuplicateAlert; /** * Process triggered alert */ private processAlert; /** * Execute alert action */ private executeAlertAction; /** * Attempt automatic remediation for alert */ private attemptAutoRemediation; /** * Schedule alert escalation */ private scheduleEscalation; /** * Send notifications for alert */ private sendNotifications; /** * Send webhook notification */ private sendWebhookNotification; /** * Send email notification */ private sendEmailNotification; /** * Check for alerts requiring escalation */ private checkEscalations; /** * Clean up resolved alerts */ private cleanupResolvedAlerts; /** * Purge oldest alerts to maintain limits */ private purgeOldestAlerts; /** * Initialize default alert rules */ private initializeDefaultRules; /** * Add or update alert rule */ addRule(rule: AlertRule): void; /** * Remove alert rule */ removeRule(ruleId: string): void; /** * Get all alert rules */ getRules(): AlertRule[]; /** * Get active alerts */ getActiveAlerts(): AlertInstance[]; /** * Get alert history */ getAlertHistory(limit?: number): AlertInstance[]; /** * Acknowledge alert */ acknowledgeAlert(alertId: string, userId: string, comment?: string): boolean; /** * Resolve alert */ resolveAlert(alertId: string, userId?: string): boolean; /** * Update alerting configuration */ updateConfiguration(newConfig: Partial): void; /** * Get alerting system statistics */ getStatistics(): { enabled: boolean; rulesCount: number; activeAlertsCount: number; totalAlertsCount: number; lastEvaluationAge: number; notificationsSent: number; notificationsFailed: number; }; } export declare const alertingSystem: AlertingSystem; /** * Helper function to start alerting system */ export declare function startSystemAlerting(config?: Partial): void; /** * Helper function to get current alert status */ export declare function getAlertStatus(): { healthy: boolean; activeAlerts: number; criticalAlerts: number; lastEvaluated: string; }; //# sourceMappingURL=alertingSystem.d.ts.map