mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-05-13 15:28:38 +00:00
fix: preserve PBS alert thresholds when updating node configuration (addresses #440)
When updating PBS nodes through the node configuration UI, alert thresholds were being reset to defaults. This was because alert overrides are stored separately from node configuration and weren't being preserved during node updates. The fix ensures that when a node is updated, the alert configuration (including any custom threshold overrides) is reloaded and preserved. This applies to both PBS and PVE nodes to ensure consistent behavior.
This commit is contained in:
parent
e731f954b3
commit
ce6a76a0f9
1 changed files with 21 additions and 0 deletions
|
|
@ -1045,6 +1045,7 @@ func (h *ConfigHandlers) HandleUpdateNode(w http.ResponseWriter, r *http.Request
|
|||
http.Error(w, "Invalid node ID", http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
// Update the node
|
||||
if nodeType == "pve" && index < len(h.config.PVEInstances) {
|
||||
|
|
@ -1145,6 +1146,26 @@ func (h *ConfigHandlers) HandleUpdateNode(w http.ResponseWriter, r *http.Request
|
|||
http.Error(w, "Failed to save configuration", http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
|
||||
// IMPORTANT: Preserve alert overrides when updating nodes
|
||||
// This fixes issue #440 where PBS alert thresholds were being reset
|
||||
// Alert overrides are stored separately from node configuration
|
||||
// and must be explicitly preserved during node updates
|
||||
if h.monitor != nil {
|
||||
// Load current alert configuration to preserve overrides
|
||||
alertConfig, err := h.persistence.LoadAlertConfig()
|
||||
if err == nil && alertConfig != nil {
|
||||
// The alert configuration contains overrides keyed by node ID
|
||||
// Since the node ID doesn't change (it's based on index), the overrides
|
||||
// remain valid and don't need migration
|
||||
// Just ensure the alert manager has the current configuration
|
||||
h.monitor.GetAlertManager().UpdateConfig(*alertConfig)
|
||||
log.Debug().
|
||||
Str("nodeID", nodeID).
|
||||
Str("nodeType", nodeType).
|
||||
Msg("Preserved alert overrides after node update")
|
||||
}
|
||||
}
|
||||
|
||||
// Reload monitor with new configuration
|
||||
if h.reloadFunc != nil {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue