UNPKG

@sailboat-computer/health-monitoring

Version:

Comprehensive health monitoring system for sailboat computer v3 with marine-specific health checks

335 lines 9.29 kB
/** * Core types for the health monitoring system */ import { common } from '@sailboat-computer/sailboat-types'; export declare const HealthStatus: { HEALTHY: common.HealthStatus; DEGRADED: common.HealthStatus; UNHEALTHY: common.HealthStatus; CRITICAL: common.HealthStatus; UNKNOWN: common.HealthStatus; }; export declare const OperationalContext: { SAILING: common.OperationalContext; MOTORING: common.OperationalContext; ANCHORED: common.OperationalContext; DOCKED: common.OperationalContext; MAINTENANCE: common.OperationalContext; EMERGENCY: common.OperationalContext; }; export declare const MarineSystemType: { NAVIGATION: common.MarineSystemType; SAFETY: common.MarineSystemType; POWER: common.MarineSystemType; COMMUNICATION: common.MarineSystemType; PROPULSION: common.MarineSystemType; COMFORT: common.MarineSystemType; MAINTENANCE: common.MarineSystemType; ENVIRONMENTAL: common.MarineSystemType; }; export type HealthStatusType = common.HealthStatus; export type OperationalContextType = common.OperationalContext; export type MarineSystemTypeType = common.MarineSystemType; export interface MarineEnvironmentStatus { status?: 'normal' | 'adverse' | 'severe'; seaState?: string; weather?: string; powerStatus?: string; criticalOperationsOnly?: boolean; [key: string]: any; } /** * Health check types */ export declare enum HealthCheckType { SENSOR = "sensor", SERVICE = "service", SYSTEM = "system", NETWORK = "network", POWER = "power", STORAGE = "storage", ENVIRONMENTAL = "environmental" } /** * Individual health check result */ export interface HealthCheckResult { checkId: string; name: string; type: HealthCheckType; marineSystemType: MarineSystemTypeType; status: HealthStatusType; score: number; message: string; details?: Record<string, any>; timestamp: Date; executionTime: number; marineContext: { operationalContext: OperationalContextType; environmentalImpact: boolean; safetyImpact: boolean; powerImpact: number; }; thresholds?: { warning: number; critical: number; unit?: string; }; trend?: { direction: 'improving' | 'stable' | 'degrading'; rate: number; confidence: number; }; } /** * Aggregated health status for a system or component */ export interface SystemHealthStatus { systemId: string; name: string; marineSystemType: MarineSystemTypeType; overallStatus: HealthStatusType; overallScore: number; healthChecks: HealthCheckResult[]; metrics: { totalChecks: number; healthyChecks: number; warningChecks: number; criticalChecks: number; offlineChecks: number; averageScore: number; lastUpdateTime: Date; }; marineData: { operationalDependency: 'essential' | 'important' | 'optional'; powerConsumption: number; environmentalSensitivity: number; maintenanceStatus: 'current' | 'due' | 'overdue'; lastMaintenanceDate?: Date; nextMaintenanceDate?: Date; }; recommendations: { immediate: string[]; scheduled: string[]; monitoring: string[]; }; } /** * Overall system health dashboard */ export interface SystemHealthDashboard { timestamp: Date; overallSystemHealth: { status: HealthStatusType; score: number; trend: 'improving' | 'stable' | 'degrading'; }; systemStatuses: SystemHealthStatus[]; marineEnvironment: MarineEnvironmentStatus; environmentalImpact: { affectedSystems: string[]; severityLevel: 'low' | 'medium' | 'high'; adaptationsActive: string[]; }; criticalAlerts: { id: string; systemId: string; message: string; severity: 'warning' | 'critical'; timestamp: Date; acknowledged: boolean; }[]; performanceMetrics: { totalHealthChecks: number; healthCheckExecutionTime: number; systemResponseTime: number; dataFreshness: number; }; resourceStatus: { powerConsumption: { current: number; average: number; peak: number; efficiency: number; }; storageHealth: { diskUsage: number; diskHealth: HealthStatusType; dataIntegrity: number; }; networkHealth: { connectivity: HealthStatusType; latency: number; throughput: number; reliability: number; }; }; } /** * Health check configuration */ export interface HealthCheckConfig { checkId: string; name: string; type: HealthCheckType; marineSystemType: MarineSystemTypeType; interval: number; timeout: number; retryCount: number; thresholds: { warning: number; critical: number; unit?: string; }; marineSettings: { operationalContexts: OperationalContextType[]; environmentalSensitivity: number; powerAware: boolean; safetyImpact: boolean; }; advanced: { trendAnalysis: boolean; predictiveAlerts: boolean; adaptiveThresholds: boolean; historicalComparison: boolean; }; } /** * Health monitoring event */ export interface HealthMonitoringEvent { eventId: string; timestamp: Date; eventType: 'health_check_completed' | 'status_changed' | 'alert_triggered' | 'system_recovery' | 'maintenance_due'; systemId: string; checkId?: string; previousStatus?: HealthStatusType; currentStatus: HealthStatusType; data: { score?: number; message: string; details?: Record<string, any>; marineContext: { operationalContext: OperationalContextType; environmentalConditions: Record<string, any>; safetyImpact: boolean; }; }; alert?: { severity: 'info' | 'warning' | 'critical'; requiresAction: boolean; recommendedActions: string[]; autoResolution: boolean; }; } /** * Health trend data */ export interface HealthTrend { systemId: string; checkId: string; timeRange: { start: Date; end: Date; intervalMs: number; }; dataPoints: { timestamp: Date; score: number; status: HealthStatusType; value?: number; marineConditions?: { seaState: string; weather: string; operationalContext: OperationalContextType; }; }[]; analysis: { direction: 'improving' | 'stable' | 'degrading'; rate: number; confidence: number; seasonality: boolean; correlations: { environmental: number; operational: number; maintenance: number; }; }; predictions: { nextWarning?: Date; nextCritical?: Date; maintenanceRecommendation?: Date; confidence: number; }; } /** * Marine-specific health metrics */ export interface MarineHealthMetrics { sensorHealth: { gps: HealthCheckResult; compass: HealthCheckResult; windSensor: HealthCheckResult; depthSounder: HealthCheckResult; speedLog: HealthCheckResult; ais: HealthCheckResult; }; powerHealth: { batteryVoltage: HealthCheckResult; chargingSystem: HealthCheckResult; powerConsumption: HealthCheckResult; solarPanels?: HealthCheckResult; windGenerator?: HealthCheckResult; shorepower?: HealthCheckResult; }; communicationHealth: { vhfRadio: HealthCheckResult; satelliteComm?: HealthCheckResult; cellularModem?: HealthCheckResult; wifi: HealthCheckResult; }; safetyHealth: { anchorAlarm: HealthCheckResult; collisionAvoidance: HealthCheckResult; emergencyBeacon?: HealthCheckResult; fireDetection?: HealthCheckResult; bilgePump?: HealthCheckResult; }; environmentalHealth: { temperature: HealthCheckResult; humidity: HealthCheckResult; barometricPressure: HealthCheckResult; waterTemperature?: HealthCheckResult; }; } /** * Health monitoring configuration */ export interface HealthMonitoringConfig { globalSettings: { defaultCheckInterval: number; defaultTimeout: number; maxConcurrentChecks: number; dataRetentionDays: number; }; marineSettings: { environmentalAdaptation: boolean; powerAwareChecking: boolean; operationalContextAware: boolean; predictiveMaintenance: boolean; }; alertSettings: { enableEmailAlerts: boolean; enableSmsAlerts: boolean; enableAudioAlerts: boolean; alertThrottling: number; escalationTimeout: number; }; dashboardSettings: { refreshInterval: number; historicalDataRange: number; trendAnalysisEnabled: boolean; predictiveAlertsEnabled: boolean; }; } //# sourceMappingURL=types.d.ts.map