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): retry unsupported HEAD probes with GET
rcourtman2018aa8a9a96
diff --git a/internal/availabilityprobe/probe.go b/internal/availabilityprobe/probe.goindex 36b8f87075..5cc8eb7501 100644--- a/internal/availabilityprobe/probe.go+++ b/internal/availabilityprobe/probe.go@@ -282,7 +282,7 @@ func probeHTTP(ctx context.Context, target config.AvailabilityTarget, timeout tiif err == nil {defer resp.Body.Close()certificate := certificateObservationFromResponse(resp)- if resp.StatusCode == http.StatusMethodNotAllowed {+ if resp.StatusCode == http.StatusMethodNotAllowed || resp.StatusCode == http.StatusNotImplemented {return probeHTTPGet(ctx, client, u)}if resp.StatusCode >= http.StatusInternalServerError {diff --git a/internal/monitoring/availability_poller_test.go b/internal/monitoring/availability_poller_test.goindex 647bc466b0..27f0f1e5e3 100644--- a/internal/monitoring/availability_poller_test.go+++ b/internal/monitoring/availability_poller_test.go@@ -14,28 +14,32 @@ import ("github.com/rcourtman/pulse-go-rewrite/pkg/tlsutil")-func TestProbeAvailabilityTargetHTTPFallsBackToGETWhenHeadNotAllowed(t *testing.T) {- server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {- switch r.Method {- case http.MethodHead:- w.WriteHeader(http.StatusMethodNotAllowed)- case http.MethodGet:- w.WriteHeader(http.StatusNoContent)- default:- w.WriteHeader(http.StatusMethodNotAllowed)- }- }))- defer server.Close()+func TestProbeAvailabilityTargetHTTPFallsBackToGETWhenHeadUnsupported(t *testing.T) {+ for _, headStatus := range []int{http.StatusMethodNotAllowed, http.StatusNotImplemented} {+ t.Run(http.StatusText(headStatus), func(t *testing.T) {+ server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {+ switch r.Method {+ case http.MethodHead:+ w.WriteHeader(headStatus)+ case http.MethodGet:+ w.WriteHeader(http.StatusNoContent)+ default:+ w.WriteHeader(http.StatusMethodNotAllowed)+ }+ }))+ defer server.Close()- target := config.NormalizeAvailabilityTarget(config.AvailabilityTarget{- Address: server.URL,- Protocol: config.AvailabilityProbeHTTP,- Enabled: true,- TimeoutMillis: 1000,- })+ target := config.NormalizeAvailabilityTarget(config.AvailabilityTarget{+ Address: server.URL,+ Protocol: config.AvailabilityProbeHTTP,+ Enabled: true,+ TimeoutMillis: 1000,+ })- if err := ProbeAvailabilityTarget(context.Background(), target); err != nil {- t.Fatalf("ProbeAvailabilityTarget() error = %v", err)+ if err := ProbeAvailabilityTarget(context.Background(), target); err != nil {+ t.Fatalf("ProbeAvailabilityTarget() error = %v", err)+ }+ })}}