Skip to content

armgit / Pulse

Public Imported from GitHub
0

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.

Skip inactive storages during content scans

rcourtman23d194128d11
diff --git a/internal/monitoring/container_disk_usage.go b/internal/monitoring/container_disk_usage.go
index 38c1a55033..9acde03973 100644
--- a/internal/monitoring/container_disk_usage.go
+++ b/internal/monitoring/container_disk_usage.go
@@ -85,6 +85,9 @@ func (m *Monitor) collectContainerRootUsage(ctx context.Context, client PVEClien
if !storageSupportsContainerVolumes(storage.Content) {
continue
}
+ if !storageContentQueryable(storage) {
+ continue
+ }
contents, err := client.GetStorageContent(ctx, node, storage.Storage)
if err != nil {
diff --git a/internal/monitoring/monitor.go b/internal/monitoring/monitor.go
index 53787dd6f5..fe7145cdd7 100644
--- a/internal/monitoring/monitor.go
+++ b/internal/monitoring/monitor.go
@@ -8436,6 +8436,9 @@ func (m *Monitor) pollStorageBackupsWithNodes(ctx context.Context, instanceName
if !strings.Contains(storage.Content, "backup") {
continue
}
+ if !storageContentQueryable(storage) {
+ continue
+ }
storagesWithBackup++
@@ -9106,6 +9109,9 @@ func (m *Monitor) collectSnapshotSizes(ctx context.Context, instanceName string,
if !strings.Contains(contentTypes, "images") && !strings.Contains(contentTypes, "rootdir") {
continue
}
+ if !storageContentQueryable(storage) {
+ continue
+ }
contents, err := client.GetStorageContent(ctx, nodeName, storage.Storage)
if err != nil {
diff --git a/internal/monitoring/monitor_snapshots_test.go b/internal/monitoring/monitor_snapshots_test.go
index efa71e4510..a6f6134dd1 100644
--- a/internal/monitoring/monitor_snapshots_test.go
+++ b/internal/monitoring/monitor_snapshots_test.go
@@ -113,7 +113,7 @@ func TestCollectSnapshotSizes(t *testing.T) {
client := fakeSnapshotClient{
storages: map[string][]proxmox.Storage{
"node1": {
- {Storage: "local-zfs", Content: "images"},
+ {Storage: "local-zfs", Content: "images", Active: 1, Enabled: 1},
},
},
contents: map[string]map[string][]proxmox.StorageContent{
diff --git a/internal/monitoring/storage_filters.go b/internal/monitoring/storage_filters.go
new file mode 100644
index 0000000000..ec5a654e28
--- /dev/null
+++ b/internal/monitoring/storage_filters.go
@@ -0,0 +1,22 @@
+package monitoring
+
+import (
+ "strings"
+
+ "github.com/rcourtman/pulse-go-rewrite/pkg/proxmox"
+)
+
+// storageContentQueryable reports whether it's safe to inspect the contents of a storage target.
+// Proxmox returns storages that exist in the datacenter config even when the current node
+// cannot access them. When Active==0 or the entry is disabled, querying /storage/<name>/content
+// yields 500 errors that make Pulse think the node is unreachable. Guard calls so we only
+// touch storages that are enabled, active on this node, and have a usable name.
+func storageContentQueryable(storage proxmox.Storage) bool {
+ if strings.TrimSpace(storage.Storage) == "" {
+ return false
+ }
+ if storage.Enabled == 0 {
+ return false
+ }
+ return storage.Active == 1
+}