uptime-kuma/server
SmartDever02 942fd5021c fix: send notifications when UK database is down (#6498)
Implement notification system that works even when database is unavailable.

Problem:
- When Uptime Kuma's database (external MariaDB/SQLite) becomes unavailable,
  UK stops functioning and cannot send notifications about its own failure.
- Users are not alerted when UK itself is having database connectivity issues.

Solution:
- Added notification cache system that stores all active notification configs
  in memory when database is available
- Implemented database error detection in both monitor.js and server.js
  error handlers to catch EHOSTUNREACH, ECONNREFUSED, and other DB errors
- Added sendDatabaseDownNotification() method that uses cached notifications
  to send alerts when database connection fails
- Cache automatically refreshes periodically (every 30 minutes) and when
  notifications are added/updated/deleted
- Prevents duplicate notifications for the same database down event

Changes:
- server/notification.js: Added cache system and database down notification
- server/server.js: Enhanced error handler to detect DB errors and trigger
  notifications, refresh cache on startup
- server/model/monitor.js: Added DB error detection in safeBeat error handler
- server/jobs.js: Added periodic cache refresh job (every 30 minutes)
- test/backend-test/test-database-down-notification.js: Comprehensive test
  suite covering cache, notifications, error handling

This ensures users are always notified when UK itself is having database
connectivity issues, even if the database is completely unavailable.
2026-01-06 03:00:34 +01:00
..
analytics fix(analytics): fixed issues with db init and refactor of code and names 2025-04-10 23:48:46 +02:00
jobs Data migration and history retention for 2.0.0 (#5075) 2024-10-26 20:50:29 +08:00
model fix: send notifications when UK database is down (#6498) 2026-01-06 03:00:34 +01:00
modules Fix crypto.randomBytes() usage in hash.js - replace with crypto.randomInt() 2025-12-29 01:38:44 +00:00
monitor-conditions Monitor Conditions (#5048) 2024-08-30 21:48:13 +02:00
monitor-types Update server/monitor-types/sip-options.js 2026-01-04 22:22:25 -05:00
notification-providers refactor: use extractAddress() method for monitor address 2026-01-06 01:43:40 +02:00
routers [Push monitor] Fix: Prometheus update with incorrect value (#6436) 2025-11-28 12:41:44 +00:00
socket-handlers Merge branch 'master' into feature/umami-analytics-status-page 2026-01-03 16:57:11 +01:00
utils 2.0.X to master (#6226) 2025-10-25 05:22:13 +08:00
2fa.js
auth.js fix(auth/UX): trim username in login & setup (#6263) 2025-10-26 19:24:42 +01:00
check-version.js Revert "feat: structured logging (JSON)" (#5175) 2024-10-09 07:43:44 +08:00
client.js feat: add platform/arch information to sendInfo (#6497) 2025-12-18 02:53:47 +00:00
config.js Merge manually 2023-12-11 02:36:08 +08:00
database.js fix: v2 migration process report is always 0 when having many monitors / dates (#6516) 2025-12-22 14:31:39 +00:00
docker.js [Eliminate Blocking] Docker monitor (#5927) 2025-06-25 13:39:00 +08:00
embedded-mariadb.js Fix: Embedded MariaDB startup issue (#5283) 2024-11-05 20:25:08 +08:00
image-data-uri.js Added JSDoc to ESLint (#3529) 2023-08-11 15:46:41 +08:00
jobs.js fix: send notifications when UK database is down (#6498) 2026-01-06 03:00:34 +01:00
notification.js fix: send notifications when UK database is down (#6498) 2026-01-06 03:00:34 +01:00
password-hash.js [Eliminate Blocking] User related (#5928) 2025-06-19 14:29:43 +08:00
prometheus.js Removed leftover from debugging 2025-12-15 14:08:14 +01:00
proxy.js chore(deps): upgrade http/https/socks proxy agents (#5548) 2025-01-26 14:21:40 +01:00
radius-client.js chore(deps): update compression dependencys and vendor the radius dependency (#6168) 2025-10-09 23:05:39 +02:00
rate-limiter.js Added JSDoc to ESLint (#3529) 2023-08-11 15:46:41 +08:00
remote-browser.js 🐛 fix(remote-browser): Remove unused test() function (#4155) 2023-12-03 20:27:09 +08:00
server.js fix: send notifications when UK database is down (#6498) 2026-01-06 03:00:34 +01:00
settings.js Added JSDoc to ESLint (#3529) 2023-08-11 15:46:41 +08:00
setup-database.js Fix: Check MySQL database name (#5991) 2025-08-31 01:26:32 +08:00
uptime-calculator.js fix: Clear all statistics and clear heartbeats not resetting uptime statistics of monitors (#6398) 2025-11-23 04:46:32 +00:00
uptime-kuma-server.js Merge branch 'master' into master 2026-01-03 17:12:44 +01:00
util-server.js chore: Extract the sqlserver monitor to its own monitor-type. Enable support conditions for a single result value. 2025-12-30 11:06:04 +00:00