Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.
Go aialertsdashboarddockerdocker-monitoringgohomelabinfrastructure-monitoringkubernetesmonitoringmspproxmoxproxmox-backup-serverproxmox-mail-gatewayproxmox-veself-hostedtruenastypescriptvspherewebhooks
fix(monitoring): honor fixed poll intervals when adaptive scheduling is off
rcourtman8d9d567f621f
diff --git a/docs/release-control/v6/internal/subsystems/monitoring.md b/docs/release-control/v6/internal/subsystems/monitoring.mdindex 9e1ca2f422..34249804c5 100644--- a/docs/release-control/v6/internal/subsystems/monitoring.md+++ b/docs/release-control/v6/internal/subsystems/monitoring.md@@ -1105,6 +1105,17 @@ tasks. A large tenant count therefore adds only one blocked dispatcher permonitor rather than another full override-sized goroutine pool, while a singlelarge tenant can still fill the configured I/O concurrency budget.+### Configured fixed poll intervals hold on both scheduler paths++An instance that carries a user-configured cadence (availability targets via+`FixedInstanceInterval`) polls at exactly that cadence whether or not the+adaptive scheduler is enabled. With adaptive polling disabled, planning+passes run on the main poll tick and re-upsert every instance task; they+preserve an already-queued pending slot instead of stamping it due-now, and+tighten it only when a freshly shortened interval justifies an earlier run.+Without this, a sixty-second availability target polls at the ten-second+tick cadence whenever adaptive polling is off, which is the default.+### Large Proxmox generations preserve reachability under bounded enrichmentThe efficient PVE poll reserves a fixed tail of the scheduler deadline anddiff --git a/internal/monitoring/availability_poller_test.go b/internal/monitoring/availability_poller_test.goindex 27f0f1e5e3..f6d92c51b1 100644--- a/internal/monitoring/availability_poller_test.go+++ b/internal/monitoring/availability_poller_test.go@@ -320,3 +320,55 @@ func TestAvailabilityCertificateTrustIncidentsRespectSelfSignedExemptionAndOptOut.Fatalf("disabled monitoring incidents = %+v, want none", incidents)}}++// Regression for #1745: with the adaptive scheduler disabled, planning passes+// run every poll tick and Upsert overwrites the queued slot, so they must not+// re-arm a pending fixed-interval task as due-now or availability targets poll+// at the tick cadence instead of their configured interval.+func TestBuildScheduledTasksWithoutSchedulerPreservesPendingFixedIntervalSlot(t *testing.T) {+ monitor := availabilityFixedIntervalTestMonitor(t, []config.AvailabilityTarget{+ {ID: "plex", Name: "Plex", Address: "plex.local", Protocol: config.AvailabilityProbeICMP, Enabled: true, PollIntervalSecs: 60},+ })+ monitor.taskQueue = NewTaskQueue()++ now := time.Now()+ first := monitor.buildScheduledTasks(now)+ if len(first) != 1 {+ t.Fatalf("expected one planned task, got %d", len(first))+ }+ if !first[0].NextRun.Equal(now) {+ t.Fatalf("new instance NextRun = %v, want immediate %v", first[0].NextRun, now)+ }+ if first[0].Interval != 60*time.Second {+ t.Fatalf("Interval = %v, want 60s", first[0].Interval)+ }++ // Simulate the post-run reschedule parking the next slot in the future.+ pending := first[0]+ pending.NextRun = now.Add(60 * time.Second)+ monitor.taskQueue.Upsert(pending)++ replanned := monitor.buildScheduledTasks(now.Add(10 * time.Second))+ if len(replanned) != 1 {+ t.Fatalf("expected one replanned task, got %d", len(replanned))+ }+ if !replanned[0].NextRun.Equal(pending.NextRun) {+ t.Fatalf("replanned NextRun = %v, want preserved %v", replanned[0].NextRun, pending.NextRun)+ }++ // A shortened configured interval still tightens the pending slot.+ shortened := availabilityFixedIntervalTestMonitor(t, []config.AvailabilityTarget{+ {ID: "plex", Name: "Plex", Address: "plex.local", Protocol: config.AvailabilityProbeICMP, Enabled: true, PollIntervalSecs: 15},+ })+ shortened.taskQueue = monitor.taskQueue+ monitor.taskQueue.Upsert(pending)+ tick := now.Add(10 * time.Second)+ tightened := shortened.buildScheduledTasks(tick)+ if len(tightened) != 1 {+ t.Fatalf("expected one tightened task, got %d", len(tightened))+ }+ want := tick.Add(15 * time.Second)+ if !tightened[0].NextRun.Equal(want) {+ t.Fatalf("tightened NextRun = %v, want %v", tightened[0].NextRun, want)+ }+}diff --git a/internal/monitoring/monitor_polling_schedule.go b/internal/monitoring/monitor_polling_schedule.goindex 6d35820a71..bf4d28a602 100644--- a/internal/monitoring/monitor_polling_schedule.go+++ b/internal/monitoring/monitor_polling_schedule.go@@ -85,10 +85,26 @@ func (m *Monitor) buildScheduledTasks(now time.Time) []ScheduledTask {if interval <= 0 {interval = DefaultSchedulerConfig().BaseInterval}+ // Planning passes run every poll tick, and Upsert overwrites the+ // queued slot. Stamping NextRun=now here re-arms every instance as+ // due immediately each tick, so a fixed-interval instance polls at+ // the tick cadence instead of its configured interval (#1745).+ // Keep a pending future slot, tightening only when the freshly+ // computed interval justifies an earlier run, mirroring the+ // adaptive path's #1437 handling.+ nextRun := now+ if m.taskQueue != nil {+ if pending, ok := m.taskQueue.Get(desc.Type, desc.Name); ok && pending.NextRun.After(now) {+ nextRun = pending.NextRun+ if candidate := now.Add(interval); candidate.Before(nextRun) {+ nextRun = candidate+ }+ }+ }tasks = append(tasks, ScheduledTask{InstanceName: desc.Name,InstanceType: desc.Type,- NextRun: now,+ NextRun: nextRun,Interval: interval,})}diff --git a/internal/monitoring/task_queue.go b/internal/monitoring/task_queue.goindex b713af06bc..cfc517cf6e 100644--- a/internal/monitoring/task_queue.go+++ b/internal/monitoring/task_queue.go@@ -88,6 +88,19 @@ func (q *TaskQueue) Upsert(task ScheduledTask) {q.entries[key] = entry}+// Get returns the queued task for an instance, if present.+func (q *TaskQueue) Get(instanceType InstanceType, instance string) (ScheduledTask, bool) {+ key := schedulerKey(instanceType, instance)+ q.mu.Lock()+ defer q.mu.Unlock()++ entry, ok := q.entries[key]+ if !ok {+ return ScheduledTask{}, false+ }+ return entry.task, true+}+// Remove deletes a task by key if present.func (q *TaskQueue) Remove(instanceType InstanceType, instance string) {key := schedulerKey(instanceType, instance)