Listen for heartbeatList in Uptime Kuma adapter to catch monitors with no status-change history (#37)

importantHeartbeatList only contains entries for status transitions, so a
monitor that's been continuously up since creation never populates it,
showing as "unknown" in ArchNest despite being healthy in Uptime Kuma.

Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
Samuel James 2026-06-21 09:06:01 -04:00 committed by GitHub
parent d50ec0076e
commit b4943b1155
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -90,6 +90,14 @@ export const uptimeKuma: IntegrationAdapter = {
const latest = beats[beats.length - 1] const latest = beats[beats.length - 1]
if (latest) lastHeartbeat.set(monitorId, latest) if (latest) lastHeartbeat.set(monitorId, latest)
}) })
// importantHeartbeatList only contains status-change events, so a monitor
// that's been continuously up since it was added has no entries there.
// heartbeatList carries the regular (non-"important") beat history and is
// sent for every monitor, so it's needed to populate those cases too.
s.on('heartbeatList', (monitorId: number, beats: Heartbeat[]) => {
const latest = beats[beats.length - 1]
if (latest) lastHeartbeat.set(monitorId, latest)
})
s.on('heartbeat', (beat: Heartbeat & { monitorID: number }) => { s.on('heartbeat', (beat: Heartbeat & { monitorID: number }) => {
lastHeartbeat.set(beat.monitorID, beat) lastHeartbeat.set(beat.monitorID, beat)
}) })