mirror of
https://github.com/MacRimi/ProxMenux.git
synced 2026-04-30 19:36:24 +00:00
Update health_monitor.py
This commit is contained in:
@@ -2546,13 +2546,16 @@ class HealthMonitor:
|
|||||||
issues = []
|
issues = []
|
||||||
vm_details = {}
|
vm_details = {}
|
||||||
|
|
||||||
# Get persistent errors first
|
# Get active (non-dismissed) errors
|
||||||
persistent_errors = health_persistence.get_active_errors('vms')
|
persistent_errors = health_persistence.get_active_errors('vms')
|
||||||
|
|
||||||
# Check if any persistent VMs/CTs have started or were dismissed
|
# Also get dismissed errors to show them as INFO
|
||||||
|
dismissed_errors = health_persistence.get_dismissed_errors()
|
||||||
|
dismissed_vm_errors = [e for e in dismissed_errors if e.get('category') == 'vms']
|
||||||
|
|
||||||
|
# Process active errors
|
||||||
for error in persistent_errors:
|
for error in persistent_errors:
|
||||||
error_key = error['error_key']
|
error_key = error['error_key']
|
||||||
is_acknowledged = error.get('acknowledged') == 1
|
|
||||||
|
|
||||||
if error_key.startswith(('vm_', 'ct_', 'vmct_')):
|
if error_key.startswith(('vm_', 'ct_', 'vmct_')):
|
||||||
vm_id = error_key.split('_', 1)[1]
|
vm_id = error_key.split('_', 1)[1]
|
||||||
@@ -2567,11 +2570,22 @@ class HealthMonitor:
|
|||||||
'id': error.get('details', {}).get('id', 'unknown'),
|
'id': error.get('details', {}).get('id', 'unknown'),
|
||||||
'type': error.get('details', {}).get('type', 'VM/CT'),
|
'type': error.get('details', {}).get('type', 'VM/CT'),
|
||||||
'first_seen': error['first_seen'],
|
'first_seen': error['first_seen'],
|
||||||
'dismissed': is_acknowledged,
|
'dismissed': False,
|
||||||
}
|
}
|
||||||
# Only add to issues if not dismissed
|
issues.append(f"{error.get('details', {}).get('type', 'VM')} {error.get('details', {}).get('id', '')}: {error['reason']}")
|
||||||
if not is_acknowledged:
|
|
||||||
issues.append(f"{error.get('details', {}).get('type', 'VM')} {error.get('details', {}).get('id', '')}: {error['reason']}")
|
# Process dismissed errors (show as INFO)
|
||||||
|
for error in dismissed_vm_errors:
|
||||||
|
error_key = error['error_key']
|
||||||
|
if error_key not in vm_details: # Don't overwrite active errors
|
||||||
|
vm_details[error_key] = {
|
||||||
|
'status': 'INFO',
|
||||||
|
'reason': error['reason'],
|
||||||
|
'id': error.get('details', {}).get('id', 'unknown'),
|
||||||
|
'type': error.get('details', {}).get('type', 'VM/CT'),
|
||||||
|
'first_seen': error['first_seen'],
|
||||||
|
'dismissed': True,
|
||||||
|
}
|
||||||
|
|
||||||
# Check for new errors in logs
|
# Check for new errors in logs
|
||||||
# Using 'warning' priority to catch potential startup issues
|
# Using 'warning' priority to catch potential startup issues
|
||||||
|
|||||||
Reference in New Issue
Block a user