Threshold Alerts & macOS Notification Center Integration #24
Notifications
Due Date
No due date set.
Depends on
#3 CPU Core Temperatures & Thermal Zone Monitoring
gronod/MacMonitor
#4 Fan Speed & Multi-Fan Telemetry
gronod/MacMonitor
#8 RAM Breakdown, Compression & Memory Pressure Monitoring
gronod/MacMonitor
#9 Storage Volumes, APFS Containers & Capacity Telemetry
gronod/MacMonitor
Reference: gronod/MacMonitor#24
Reference in New Issue
Block a user
Purpose
Detect abnormal system conditions and dispatch native macOS system notifications when configurable hardware thresholds are breached (e.g. CPU temperature exceeds safe limits, cooling fan failure, critical memory pressure, low disk space, or low battery).
Priority
Medium (Proactive protection and warning system for unattended hardware workloads)
Dependencies
Scope
UserNotifications.Implementation Suggestions
AlertEngine) that inspects telemetry snapshots after every sampling pass.UNUserNotificationCenter.current().requestAuthorization(options: [.alert, .sound]).Technical Implementation Plan & Code Solution
1. Alert Engine Architecture
The Alert Engine runs synchronously after each telemetry digest pass, evaluating threshold conditions against configured limits and applying cooldown timers to prevent notification storms.
2. Swift Implementation (
AlertEngine.swift)3. Anti-Spam & Hysteresis
Implemented in PR #26 targeting
milestone/m5-alerts-hardening.Delivered
AlertEngine(@Observable, @MainActor) evaluating all five threshold rules — CPU temperature, fan stall, low memory/critical pressure, per-volume low storage, low battery — against a SendableAlertEvaluationContextafter each sample pass.UNUserNotificationCenterdelivery behind a mockableAlertNotificationDispatchingprotocol; authorization requested at launch;MM_ALERTcategory with Open MacMonitor / View Processes actions routed viaAppNavigationBus.AlertsSettingsView) for per-rule toggles, thresholds, cooldown, permission status, and test notification.Verified
xcodebuild build test -scheme MacMonitor -destination 'platform=macOS,arch=x86_64'— 87 tests, 0 failures (25 new alert tests).swiftlint lint— 0 violations.