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
feat: add PBS/PMG stubs to test harness and implement HTTP config fetch
rcourtman73fb9d986f74
diff --git a/cmd/pulse/config.go b/cmd/pulse/config.goindex 0f64bae818..6314c7b17e 100644--- a/cmd/pulse/config.go+++ b/cmd/pulse/config.go@@ -5,9 +5,12 @@ import ("encoding/base64""fmt""io/ioutil"+ "net/http"+ "net/url""os""strings""syscall"+ "time""github.com/rcourtman/pulse-go-rewrite/internal/config""github.com/spf13/cobra"@@ -223,8 +226,39 @@ var configAutoImportCmd = &cobra.Command{// Get data from URL or direct dataif configURL != "" {- // TODO: Implement HTTP fetch for config URL- return fmt.Errorf("URL import not yet implemented")+ parsedURL, err := url.Parse(configURL)+ if err != nil {+ return fmt.Errorf("invalid PULSE_INIT_CONFIG_URL: %w", err)+ }+ if parsedURL.Scheme != "http" && parsedURL.Scheme != "https" {+ return fmt.Errorf("unsupported URL scheme %q for PULSE_INIT_CONFIG_URL", parsedURL.Scheme)+ }++ client := &http.Client{Timeout: 15 * time.Second}+ resp, err := client.Get(configURL)+ if err != nil {+ return fmt.Errorf("failed to fetch configuration from URL: %w", err)+ }+ defer resp.Body.Close()++ if resp.StatusCode < 200 || resp.StatusCode >= 300 {+ return fmt.Errorf("failed to fetch configuration from URL: %s", resp.Status)+ }++ body, err := ioutil.ReadAll(resp.Body)+ if err != nil {+ return fmt.Errorf("failed to read configuration response: %w", err)+ }+ if len(body) == 0 {+ return fmt.Errorf("configuration response from URL was empty")+ }++ trimmed := strings.TrimSpace(string(body))+ if decoded, err := base64.StdEncoding.DecodeString(trimmed); err == nil {+ encryptedData = string(decoded)+ } else {+ encryptedData = string(body)+ }} else if configData != "" {// Decode base64 if neededif decoded, err := base64.StdEncoding.DecodeString(configData); err == nil {diff --git a/internal/monitoring/harness_integration.go b/internal/monitoring/harness_integration.goindex 932cd4ae23..91eb70d460 100644--- a/internal/monitoring/harness_integration.go+++ b/internal/monitoring/harness_integration.go@@ -11,6 +11,8 @@ import ("time""github.com/rcourtman/pulse-go-rewrite/internal/config"+ "github.com/rcourtman/pulse-go-rewrite/pkg/pbs"+ "github.com/rcourtman/pulse-go-rewrite/pkg/pmg""github.com/rcourtman/pulse-go-rewrite/pkg/proxmox")@@ -80,29 +82,29 @@ type ResourceStats struct {// HarnessReport is returned after a harness run completes.type HarnessReport struct {- Scenario HarnessScenario- PerInstanceStats map[string]InstanceStats- QueueStats QueueStats- StalenessStats StalenessStats- ResourceStats ResourceStats- Health SchedulerHealthResponse- MaxStaleness time.Duration- RuntimeSamples []runtimeSnapshot+ Scenario HarnessScenario+ PerInstanceStats map[string]InstanceStats+ QueueStats QueueStats+ StalenessStats StalenessStats+ ResourceStats ResourceStats+ Health SchedulerHealthResponse+ MaxStaleness time.Duration+ RuntimeSamples []runtimeSnapshot}// Harness orchestrates the integration run.type Harness struct {- Monitor *Monitor- Executor *fakeExecutor- cancel context.CancelFunc- scenario HarnessScenario- dataPath string- queueMax int- queueSum int- queueSamples int- maxStaleness time.Duration- sampleEvery time.Duration- runtimeSamples []runtimeSnapshot+ Monitor *Monitor+ Executor *fakeExecutor+ cancel context.CancelFunc+ scenario HarnessScenario+ dataPath string+ queueMax int+ queueSum int+ queueSamples int+ maxStaleness time.Duration+ sampleEvery time.Duration+ runtimeSamples []runtimeSnapshotlastRuntimeSample time.Time}@@ -146,9 +148,9 @@ func NewHarness(scenario HarnessScenario) *Harness {case "pve":monitor.pveClients[inst.Name] = noopPVEClient{}case "pbs":- // TODO: add PBS stub when needed.+ monitor.pbsClients[inst.Name] = &pbs.Client{}case "pmg":- // TODO: add PMG stub when needed.+ monitor.pmgClients[inst.Name] = &pmg.Client{}default:// Unsupported types are ignored for now.}@@ -251,12 +253,12 @@ loop:GCCountStart: startSample.NumGC,GCCountEnd: endSample.NumGC,},- Health: health,- MaxStaleness: h.maxStaleness,+ Health: health,+ MaxStaleness: h.maxStaleness,RuntimeSamples: runtimeSamplesCopy,}- return report+ return report}func (h *Harness) schedule(now time.Time) {@@ -386,9 +388,11 @@ func (noopPVEClient) GetVMs(ctx context.Context, node string) ([]proxmox.VM, errfunc (noopPVEClient) GetContainers(ctx context.Context, node string) ([]proxmox.Container, error) {return nil, nil}-func (noopPVEClient) GetStorage(ctx context.Context, node string) ([]proxmox.Storage, error) { return nil, nil }-func (noopPVEClient) GetAllStorage(ctx context.Context) ([]proxmox.Storage, error) { return nil, nil }-func (noopPVEClient) GetBackupTasks(ctx context.Context) ([]proxmox.Task, error) { return nil, nil }+func (noopPVEClient) GetStorage(ctx context.Context, node string) ([]proxmox.Storage, error) {+ return nil, nil+}+func (noopPVEClient) GetAllStorage(ctx context.Context) ([]proxmox.Storage, error) { return nil, nil }+func (noopPVEClient) GetBackupTasks(ctx context.Context) ([]proxmox.Task, error) { return nil, nil }func (noopPVEClient) GetStorageContent(ctx context.Context, node, storage string) ([]proxmox.StorageContent, error) {return nil, nil}@@ -423,6 +427,8 @@ func (noopPVEClient) GetZFSPoolStatus(ctx context.Context, node string) ([]proxmfunc (noopPVEClient) GetZFSPoolsWithDetails(ctx context.Context, node string) ([]proxmox.ZFSPoolInfo, error) {return nil, nil}-func (noopPVEClient) GetDisks(ctx context.Context, node string) ([]proxmox.Disk, error) { return nil, nil }-func (noopPVEClient) GetCephStatus(ctx context.Context) (*proxmox.CephStatus, error) { return nil, nil }-func (noopPVEClient) GetCephDF(ctx context.Context) (*proxmox.CephDF, error) { return nil, nil }+func (noopPVEClient) GetDisks(ctx context.Context, node string) ([]proxmox.Disk, error) {+ return nil, nil+}+func (noopPVEClient) GetCephStatus(ctx context.Context) (*proxmox.CephStatus, error) { return nil, nil }+func (noopPVEClient) GetCephDF(ctx context.Context) (*proxmox.CephDF, error) { return nil, nil }