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.

fix: hotfix 5.1.5 — node duplication, alert scrambling, ntfy resolved formatting

rcourtman8a48acef1dda
diff --git a/VERSION b/VERSION
index 76e9e619d6..220d8e0a46 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-5.1.4
+5.1.5
diff --git a/frontend-modern/src/components/Docker/DockerFilter.tsx b/frontend-modern/src/components/Docker/DockerFilter.tsx
index 5693a94703..2ebe21b299 100644
--- a/frontend-modern/src/components/Docker/DockerFilter.tsx
+++ b/frontend-modern/src/components/Docker/DockerFilter.tsx
@@ -4,6 +4,7 @@ import { SearchTipsPopover } from '@/components/shared/SearchTipsPopover';
import { MetricsViewToggle } from '@/components/shared/MetricsViewToggle';
import { STORAGE_KEYS } from '@/utils/localStorage';
import { createSearchHistoryManager } from '@/utils/searchHistory';
+import { shouldHideDockerUpdateActions } from '@/stores/systemSettings';
export type DockerViewMode = 'grouped' | 'flat' | 'cluster';
@@ -510,7 +511,7 @@ export const DockerFilter: Component<DockerFilterProps> = (props) => {
{/* Metrics View Toggle */}
<MetricsViewToggle />
- <Show when={props.updateAvailableCount && props.updateAvailableCount > 1}>
+ <Show when={props.updateAvailableCount && props.updateAvailableCount > 1 && !shouldHideDockerUpdateActions()}>
<div class="h-5 w-px bg-gray-200 dark:bg-gray-600 hidden sm:block" aria-hidden="true"></div>
<UpdateAllButton
count={props.updateAvailableCount!}
diff --git a/frontend-modern/src/components/UpdateBanner.tsx b/frontend-modern/src/components/UpdateBanner.tsx
index ea5f753986..868b8a4633 100644
--- a/frontend-modern/src/components/UpdateBanner.tsx
+++ b/frontend-modern/src/components/UpdateBanner.tsx
@@ -137,7 +137,7 @@ export function UpdateBanner() {
)}
{!isExpanded() && (
<a
- href={`https://github.com/rcourtman/Pulse/releases/tag/${updateStore.updateInfo()?.latestVersion}`}
+ href={`https://github.com/rcourtman/Pulse/releases/tag/v${updateStore.updateInfo()?.latestVersion}`}
target="_blank"
rel="noopener noreferrer"
class="text-blue-600 dark:text-blue-400 underline text-sm hidden sm:inline hover:text-blue-700 dark:hover:text-blue-300"
@@ -256,7 +256,7 @@ export function UpdateBanner() {
<div class="flex gap-3 mt-2">
<a
- href={`https://github.com/rcourtman/Pulse/releases/tag/${updateStore.updateInfo()?.latestVersion}`}
+ href={`https://github.com/rcourtman/Pulse/releases/tag/v${updateStore.updateInfo()?.latestVersion}`}
target="_blank"
rel="noopener noreferrer"
class="text-blue-600 dark:text-blue-400 underline hover:text-blue-700 dark:hover:text-blue-300 text-xs"
diff --git a/internal/alerts/alerts.go b/internal/alerts/alerts.go
index 7d720191fd..dffe1bb8cb 100644
--- a/internal/alerts/alerts.go
+++ b/internal/alerts/alerts.go
@@ -6,6 +6,7 @@ import (
"math"
"os"
"path/filepath"
+ "sort"
"strconv"
"strings"
"sync"
@@ -6744,6 +6745,15 @@ func (m *Manager) GetActiveAlerts() []Alert {
}
alerts = append(alerts, a)
}
+
+ // Sort to ensure stable ordering across poll cycles (map iteration is random)
+ sort.Slice(alerts, func(i, j int) bool {
+ if alerts[i].Node != alerts[j].Node {
+ return alerts[i].Node < alerts[j].Node
+ }
+ return alerts[i].ID < alerts[j].ID
+ })
+
return alerts
}
diff --git a/internal/models/models.go b/internal/models/models.go
index f93a6ecc08..6cd03afa79 100644
--- a/internal/models/models.go
+++ b/internal/models/models.go
@@ -1323,18 +1323,22 @@ func (s *State) UpdateNodesForInstance(instanceName string, nodes []Node) {
s.mu.Lock()
defer s.mu.Unlock()
- // Build a map of ALL existing nodes by ID (not filtered by instance)
- // This handles cluster-based IDs where the same node ID comes from multiple instances
- // Also preserve LinkedHostAgentID for nodes that are being updated
+ // Preserve LinkedHostAgentID for nodes that are being updated
existingNodeLinks := make(map[string]string) // nodeID -> linkedHostAgentID
- nodeMap := make(map[string]Node)
for _, node := range s.Nodes {
- nodeMap[node.ID] = node
if node.LinkedHostAgentID != "" {
existingNodeLinks[node.ID] = node.LinkedHostAgentID
}
}
+ // Build map excluding nodes from this instance (they'll be replaced by the new set)
+ nodeMap := make(map[string]Node)
+ for _, node := range s.Nodes {
+ if node.Instance != instanceName {
+ nodeMap[node.ID] = node
+ }
+ }
+
// Build hostname-to-hostAgentID map for linking new nodes to existing host agents
// Also build a set of valid host agent IDs to validate existing links
hostAgentByHostname := make(map[string]string) // lowercase hostname -> hostAgentID
diff --git a/internal/monitoring/monitor.go b/internal/monitoring/monitor.go
index 9a7ede1804..bf2d9005ee 100644
--- a/internal/monitoring/monitor.go
+++ b/internal/monitoring/monitor.go
@@ -7032,10 +7032,10 @@ func (m *Monitor) pollVMsAndContainersEfficient(ctx context.Context, instanceNam
allocatedDiskGB := float64(res.MaxDisk) / 1073741824
reportedDiskGB := float64(totalBytes) / 1073741824
- // If reported disk is more than 2x the allocated disk, log a warning
- // This could indicate we're getting host disk or network shares
+ // If reported disk is more than 2x the allocated disk, log for debugging
+ // This is expected for VMs with pass-through disks, NFS mounts, or ZFS datasets
if allocatedDiskGB > 0 && reportedDiskGB > allocatedDiskGB*2 {
- log.Warn().
+ log.Debug().
Str("instance", instanceName).
Str("vm", res.Name).
Int("vmid", res.VMID).
diff --git a/internal/notifications/notifications.go b/internal/notifications/notifications.go
index ab380d4982..bd8200832e 100644
--- a/internal/notifications/notifications.go
+++ b/internal/notifications/notifications.go
@@ -1807,6 +1807,11 @@ func (n *NotificationManager) sendResolvedWebhook(webhook WebhookConfig, alertLi
resolvedAt = time.Now()
}
+ // ntfy needs plain-text body + headers, not JSON
+ if webhook.Service == "ntfy" {
+ return n.sendResolvedWebhookNtfy(webhook, alertList, resolvedAt)
+ }
+
payload := map[string]interface{}{
"event": string(eventResolved),
"alerts": alertList,
@@ -1837,6 +1842,97 @@ func (n *NotificationManager) sendResolvedWebhook(webhook WebhookConfig, alertLi
return n.sendWebhookRequest(webhook, jsonData, "resolved")
}
+// sendResolvedWebhookNtfy sends a resolved webhook formatted for ntfy (plain text + headers)
+func (n *NotificationManager) sendResolvedWebhookNtfy(webhook WebhookConfig, alertList []*alerts.Alert, resolvedAt time.Time) error {
+ // Re-validate webhook URL
+ if err := n.ValidateWebhookURL(webhook.URL); err != nil {
+ return fmt.Errorf("webhook URL validation failed: %w", err)
+ }
+
+ if !n.checkWebhookRateLimit(webhook.URL) {
+ return fmt.Errorf("rate limit exceeded for webhook %s", webhook.Name)
+ }
+
+ // Build plain-text body
+ var body strings.Builder
+ if len(alertList) == 1 && alertList[0] != nil {
+ a := alertList[0]
+ fmt.Fprintf(&body, "Resolved: %s on %s is now healthy", a.ResourceName, a.Node)
+ } else {
+ fmt.Fprintf(&body, "%d alerts resolved at %s:\n", len(alertList), resolvedAt.Format(time.RFC822))
+ for _, a := range alertList {
+ if a != nil {
+ fmt.Fprintf(&body, "- %s on %s\n", a.ResourceName, a.Node)
+ }
+ }
+ }
+
+ // Build title
+ title := "RESOLVED"
+ if len(alertList) == 1 && alertList[0] != nil {
+ title = fmt.Sprintf("RESOLVED: %s", alertList[0].ResourceName)
+ } else {
+ title = fmt.Sprintf("RESOLVED: %d alerts", len(alertList))
+ }
+
+ method := webhook.Method
+ if method == "" {
+ method = "POST"
+ }
+
+ req, err := http.NewRequest(method, webhook.URL, bytes.NewBufferString(body.String()))
+ if err != nil {
+ return fmt.Errorf("failed to create ntfy request: %w", err)
+ }
+
+ req.Header.Set("Content-Type", "text/plain")
+ req.Header.Set("Title", title)
+ req.Header.Set("Priority", "default")
+ req.Header.Set("Tags", "white_check_mark,pulse,resolved")
+ req.Header.Set("User-Agent", "Pulse-Monitoring/2.0")
+
+ // Apply any custom headers from webhook config
+ for key, value := range webhook.Headers {
+ if !strings.Contains(value, "{{") {
+ req.Header.Set(key, value)
+ }
+ }
+
+ resp, err := n.webhookClient.Do(req)
+ if err != nil {
+ log.Error().
+ Err(err).
+ Str("webhook", webhook.Name).
+ Msg("Failed to send resolved ntfy webhook")
+ return fmt.Errorf("failed to send ntfy webhook: %w", err)
+ }
+ defer resp.Body.Close()
+
+ // Read response with size limit
+ limitedReader := io.LimitReader(resp.Body, WebhookMaxResponseSize)
+ var respBody bytes.Buffer
+ respBody.ReadFrom(limitedReader)
+
+ if resp.StatusCode >= 200 && resp.StatusCode < 300 {
+ log.Info().
+ Str("webhook", webhook.Name).
+ Str("service", "ntfy").
+ Str("type", "resolved").
+ Int("status", resp.StatusCode).
+ Int("alertCount", len(alertList)).
+ Msg("Resolved ntfy webhook sent successfully")
+ return nil
+ }
+
+ log.Warn().
+ Str("webhook", webhook.Name).
+ Str("service", "ntfy").
+ Int("status", resp.StatusCode).
+ Str("response", respBody.String()).
+ Msg("Resolved ntfy webhook returned non-success status")
+ return fmt.Errorf("ntfy webhook returned HTTP %d: %s", resp.StatusCode, respBody.String())
+}
+
// checkWebhookRateLimit checks if a webhook can be sent based on rate limits
func (n *NotificationManager) checkWebhookRateLimit(webhookURL string) bool {
n.webhookRateMu.Lock()