mirror of
https://github.com/MacRimi/ProxMenux.git
synced 2026-04-30 19:36:24 +00:00
Update HealthMonitor
This commit is contained in:
@@ -460,7 +460,7 @@ def delete_storage_exclusion(storage_name):
|
|||||||
|
|
||||||
# ═══════════════════════════════════════════════════════════════════════════
|
# ═══════════════════════════════════════════════════════════════════════════
|
||||||
# NETWORK INTERFACE EXCLUSION ROUTES
|
# NETWORK INTERFACE EXCLUSION ROUTES
|
||||||
# ═══════════════════════════════════════════════════════════════════════════
|
# ══════════════════<EFBFBD><EFBFBD><EFBFBD>════════════════════════════════════════════════════════
|
||||||
|
|
||||||
@health_bp.route('/api/health/interfaces', methods=['GET'])
|
@health_bp.route('/api/health/interfaces', methods=['GET'])
|
||||||
def get_network_interfaces():
|
def get_network_interfaces():
|
||||||
|
|||||||
@@ -3884,7 +3884,7 @@ class HealthMonitor:
|
|||||||
status = 'WARNING'
|
status = 'WARNING'
|
||||||
reason = 'Failed to check for updates (apt-get error)'
|
reason = 'Failed to check for updates (apt-get error)'
|
||||||
|
|
||||||
# ── Build checks dict ────────<EFBFBD><EFBFBD>────────────────────────
|
# ── Build checks dict ─────────────────────────────────
|
||||||
age_dismissed = bool(age_result and age_result.get('type') == 'skipped_acknowledged')
|
age_dismissed = bool(age_result and age_result.get('type') == 'skipped_acknowledged')
|
||||||
update_age_status = 'CRITICAL' if (last_update_days and last_update_days >= 548) else (
|
update_age_status = 'CRITICAL' if (last_update_days and last_update_days >= 548) else (
|
||||||
'INFO' if age_dismissed else ('WARNING' if (last_update_days and last_update_days >= 365) else 'OK'))
|
'INFO' if age_dismissed else ('WARNING' if (last_update_days and last_update_days >= 365) else 'OK'))
|
||||||
|
|||||||
@@ -906,7 +906,7 @@ class HealthPersistence:
|
|||||||
|
|
||||||
# Get all active (unresolved) errors with first_seen and last_seen for age checks
|
# Get all active (unresolved) errors with first_seen and last_seen for age checks
|
||||||
cursor.execute('''
|
cursor.execute('''
|
||||||
SELECT id, error_key, category, message, first_seen, last_seen, severity FROM errors
|
SELECT id, error_key, category, reason, first_seen, last_seen, severity FROM errors
|
||||||
WHERE resolved_at IS NULL
|
WHERE resolved_at IS NULL
|
||||||
''')
|
''')
|
||||||
active_errors = cursor.fetchall()
|
active_errors = cursor.fetchall()
|
||||||
@@ -1016,7 +1016,7 @@ class HealthPersistence:
|
|||||||
return 0
|
return 0
|
||||||
|
|
||||||
for error_row in active_errors:
|
for error_row in active_errors:
|
||||||
err_id, error_key, category, message, first_seen, last_seen, severity = error_row
|
err_id, error_key, category, reason, first_seen, last_seen, severity = error_row
|
||||||
should_resolve = False
|
should_resolve = False
|
||||||
resolution_reason = None
|
resolution_reason = None
|
||||||
age_hours = get_age_hours(first_seen)
|
age_hours = get_age_hours(first_seen)
|
||||||
@@ -1025,7 +1025,7 @@ class HealthPersistence:
|
|||||||
# === VM/CT ERRORS ===
|
# === VM/CT ERRORS ===
|
||||||
# Check if VM/CT still exists (covers: vms category, vm_*, ct_* error keys)
|
# Check if VM/CT still exists (covers: vms category, vm_*, ct_* error keys)
|
||||||
if category == 'vms' or (error_key and (error_key.startswith('vm_') or error_key.startswith('ct_'))):
|
if category == 'vms' or (error_key and (error_key.startswith('vm_') or error_key.startswith('ct_'))):
|
||||||
vmid = extract_vmid_from_text(error_key) or extract_vmid_from_text(message)
|
vmid = extract_vmid_from_text(error_key) or extract_vmid_from_text(reason)
|
||||||
if vmid and not check_vm_ct_cached(vmid):
|
if vmid and not check_vm_ct_cached(vmid):
|
||||||
should_resolve = True
|
should_resolve = True
|
||||||
resolution_reason = 'VM/CT deleted'
|
resolution_reason = 'VM/CT deleted'
|
||||||
@@ -1082,7 +1082,7 @@ class HealthPersistence:
|
|||||||
# Check if service exists or if it references a deleted CT
|
# Check if service exists or if it references a deleted CT
|
||||||
elif category in ('services', 'pve_services'):
|
elif category in ('services', 'pve_services'):
|
||||||
# First check if it references a CT that no longer exists
|
# First check if it references a CT that no longer exists
|
||||||
vmid = extract_vmid_from_text(message) or extract_vmid_from_text(error_key)
|
vmid = extract_vmid_from_text(reason) or extract_vmid_from_text(error_key)
|
||||||
if vmid and not check_vm_ct_cached(vmid):
|
if vmid and not check_vm_ct_cached(vmid):
|
||||||
should_resolve = True
|
should_resolve = True
|
||||||
resolution_reason = 'Container deleted'
|
resolution_reason = 'Container deleted'
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ from pathlib import Path
|
|||||||
|
|
||||||
# ─── Shared State for Cross-Watcher Coordination ──────────────────
|
# ─── Shared State for Cross-Watcher Coordination ──────────────────
|
||||||
|
|
||||||
# ─── Startup Grace Period ───────────────────────────────────────────────────<EFBFBD><EFBFBD>
|
# ─── Startup Grace Period ────────────────────────────────────────────────────
|
||||||
# Import centralized startup grace management
|
# Import centralized startup grace management
|
||||||
# This provides a single source of truth for all grace period logic
|
# This provides a single source of truth for all grace period logic
|
||||||
import startup_grace
|
import startup_grace
|
||||||
|
|||||||
Reference in New Issue
Block a user